LCOV - code coverage report
Current view: top level - pkg/lib - python.ts Coverage Total Hit
Test: cockpit Lines: 100.0 % 12 12
Test Date: 2026-06-25 09:20:42

            Line data    Source code
       1              : /*
       2              :  * Copyright (C) 2017 Red Hat, Inc.
       3              :  * SPDX-License-Identifier: LGPL-2.1-or-later
       4              :  */
       5              : 
       6          291 : import cockpit, { BasicError } from "cockpit";
       7              : 
       8          291 : const pyinvoke = ["sh", "-ec", "exec $(command -v /usr/libexec/platform-python || command -v python3) -c \"$@\"", "--"];
       9              : 
      10              : export interface PythonExitStatus extends BasicError {
      11              :     exit_status: number | null,
      12              :     exit_signal: number | null,
      13              : }
      14              : 
      15              : // only declare the string variant for the time being; we don't use the binary variant
      16          278 : export function spawn (
      17          278 :     script_pieces: string | string[],
      18          278 :     args?: string[],
      19          278 :     options?: cockpit.SpawnOptions & { binary?: false; }
      20          278 : ): cockpit.Spawn<string> {
      21          278 :     const script = (typeof script_pieces == "string")
      22          272 :         ? script_pieces
      23          145 :         : script_pieces.join("\n");
      24              : 
      25           96 :     return cockpit.spawn(pyinvoke.concat([script]).concat(args ?? []), options);
      26          278 : }
        

Generated by: LCOV version 2.0-1