lib: Avoid `which` in python.js

This isn't installed everywhere any more. Use `command -v`.

Also drop the long-obsolete check for `python`, all our images have
Python 3 now.
This commit is contained in:
Martin Pitt 2023-06-01 07:43:26 +02:00 committed by Martin Pitt
parent 858f559436
commit 06aba4d08e
1 changed files with 1 additions and 2 deletions

View File

@ -19,8 +19,7 @@
import cockpit from "cockpit";
// FIXME: eventually convert all images to python 3
const pyinvoke = ["sh", "-ec", "exec $(which /usr/libexec/platform-python 2>/dev/null || which python3 2>/dev/null || which python) -c \"$@\"", "--"];
const pyinvoke = ["sh", "-ec", "exec $(command -v /usr/libexec/platform-python || command -v python3) -c \"$@\"", "--"];
export function spawn (script_pieces, args, options) {
const script = (typeof script_pieces == "string")