From 4e7a000541fd43a40f02ff94f8692dd0415a2428 Mon Sep 17 00:00:00 2001 From: tomasmatus Date: Thu, 7 Nov 2024 14:31:11 +0100 Subject: [PATCH] lib: python.ts add exception type Add exception type to handle cases when spawned python script exits with error. --- pkg/lib/python.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/lib/python.ts b/pkg/lib/python.ts index 12c420351f54..a2c72977fb0a 100644 --- a/pkg/lib/python.ts +++ b/pkg/lib/python.ts @@ -17,10 +17,15 @@ * along with Cockpit; If not, see . */ -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[],