Check whether a command exists on the system PATH.
Uses where on Windows or which on Unix to locate the executable.
The command name to look up (e.g., 'npm', 'git').
true if the command is found, false otherwise.
Kill all processes listening on a given TCP port.
Used by SmokeTestPhase to clean up MJAPI and Explorer service
processes after smoke test health checks complete. Without port-based
cleanup, turbo/node grandchild processes survive parent shell termination
and block future starts with EADDRINUSE.
netstat -ano to find listening PIDs, then
taskkill /F /T to kill each process tree.lsof -ti tcp:<port> -sTCP:LISTEN and sends SIGKILL to each PID — listeners
only, so client connections to the port (the installer's own) are spared.TCP port number to scan for listening processes.
Kill a process and its entire process tree.
On Windows, a .cmd shim runs inside cmd.exe, and child.kill() only terminates that
top-level shell, leaving turbo/node grandchild processes
running as orphans. This method uses taskkill /F /T /PID on Windows
and process group signals (SIGTERM then SIGKILL) on Unix to ensure
the full process tree is terminated.
Process ID of the root process to kill. No-op if undefined.
Spawn a child process and return the full result after it exits.
The process is spawned without a shell. On Windows, cross-spawn resolves
.cmd shims and escapes each argument, so an argument is never read as shell
syntax (a plain shell: true would hand it to cmd.exe as-is). Stdout and stderr are accumulated
in memory and optionally streamed line-by-line via callbacks.
If ProcessOptions.TimeoutMs is set and the process exceeds it,
the entire process tree is killed and { TimedOut: true } is returned.
The command to execute (e.g., 'npm', 'npx').
Command arguments (e.g., ['install', '--legacy-peer-deps']).
Optionaloptions: ProcessOptionsExecution options (cwd, env, timeout, streaming callbacks).
The process result with exit code, output, and timeout status.
Run a command and return just the trimmed stdout.
Convenience wrapper around Run for simple commands where you only
need the output text. Throws an Error if the process exits with a
non-zero code.
The command to execute.
Command arguments.
Optionalcwd: stringOptional working directory.
Trimmed stdout output.
Cross-platform child process runner with streaming output, timeout support, and process tree cleanup.
Key behaviors:
cross-spawnto resolve.cmdshims safely.Example