MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / killWindowsProcessTree

Function killWindowsProcessTree

scripts/dev-process-utils.mjs:113–124  ·  view source on GitHub ↗

* Windows has no POSIX process groups: ChildProcess#kill reaches only the * direct child (e.g. the uvx wrapper), leaving grandchildren — the actual * python agent-server holding its port — running. `taskkill /t` walks the * child tree instead. Windows also has no graceful tree signal (taskkill *

(proc, signal)

Source from the content-addressed store, hash-verified

111 * a failure to spawn taskkill itself falls back to the direct kill.
112 */
113function killWindowsProcessTree(proc, signal) {
114 const result = spawnSync(
115 "taskkill",
116 ["/pid", String(proc.pid), "/t", "/f"],
117 // windowsHide avoids a console window flash when invoked from the
118 // packaged (GUI) Electron process.
119 { stdio: "ignore", windowsHide: true },
120 );
121 if (result.error) {
122 proc.kill(signal);
123 }
124}
125
126export function createShutdownHookRegistry(onError) {
127 const hooks = new Set();

Callers 1

signalProcessTreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected