Skip to content

Commit

Permalink
lib: python.ts add exception type
Browse files Browse the repository at this point in the history
Add exception type to handle cases when spawned python script exits with
error.
  • Loading branch information
tomasmatus committed Nov 11, 2024
1 parent f474f0d commit 4e7a000
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/lib/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@
* along with Cockpit; If not, see <https://www.gnu.org/licenses/>.
*/

import cockpit from "cockpit";
import cockpit, { BasicError } from "cockpit";

const pyinvoke = ["sh", "-ec", "exec $(command -v /usr/libexec/platform-python || command -v python3) -c \"$@\"", "--"];

export interface PythonExitStatus extends BasicError {
exit_status: number | null,
exit_signal: number | null,
}

// only declare the string variant for the time being; we don't use the binary variant
export function spawn (
script_pieces: string | string[],
Expand Down

0 comments on commit 4e7a000

Please sign in to comment.