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:<port> | xargs kill -9.TCP port number to scan for listening processes.
Kill a process and its entire process tree.
On Windows, child.kill() with shell: true only terminates the
top-level cmd.exe 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 with shell: true on Windows (for .cmd shim
resolution) and shell: false on Unix. 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:
shell: trueto resolve.cmdshims.Example