Skip to content

Replacements for cross-spawn ​

NOTE

If your application does not need to support Windows, you can likely drop cross-spawn entirely as it solely exists to provide Windows spawn compatibility. You can use the built-in node:child_process in that case.

tinyexec ​

tinyexec is a minimal, dependency-free process execution library.

cross-spawn follows the Node.js spawn API and returns a ChildProcess. In comparison, tinyexec returns an awaitable result containing the process output and exit code.

Example:

ts
import spawn from 'cross-spawn'
import { x } from 'tinyexec'

const child = spawn('npm', ['list', '-g']) 
const { stdout, exitCode } = await x('npm', ['list', '-g']) 

child.stdout?.on('data', (output) => console.log(output.toString())) 
console.log(stdout, exitCode) 

Released under the MIT License. (13757e3d)