MCPcopy
hub / github.com/volcengine/OpenViking / _exec_binary

Function _exec_binary

openviking_cli/rust_cli.py:27–39  ·  view source on GitHub ↗

Execute a binary, replacing the current process on Unix. On Windows, ``os.execv`` does not truly replace the process — CPython's MSVC implementation spawns a child process instead. This breaks console handle inheritance and prevents the Rust TUI from receiving keyboard input (see #

(binary: str, argv: list[str])

Source from the content-addressed store, hash-verified

25
26
27def _exec_binary(binary: str, argv: list[str]) -> None:
28 """Execute a binary, replacing the current process on Unix.
29
30 On Windows, ``os.execv`` does not truly replace the process — CPython's
31 MSVC implementation spawns a child process instead. This breaks console
32 handle inheritance and prevents the Rust TUI from receiving keyboard
33 input (see #587). We use ``subprocess.call`` on Windows to work around
34 this.
35 """
36 if sys.platform == "win32":
37 sys.exit(subprocess.call([binary] + argv))
38 else:
39 os.execv(binary, [binary] + argv)
40
41
42def main():

Callers 1

mainFunction · 0.85

Calls 1

callMethod · 0.80

Tested by

no test coverage detected