superspawn
A Node.js spawn command that works on Windows too.
Original source from Apache Cordova's superspawn.js by Andrew Grieve. Requires Node.js 0.10+.
Windows extras
- Sets '/c' flag so files other than
.exe
can be run. Supported:.exe, .cmd, .bat, .js, .vbs
- Sets '/s' flags so commands (and paths) containing spaces or quotes are parsed correctly.
See this Node bug.
Install
npm i --save superspawn
Usage
Superspawn uses the same signature as the native child_process.spawn. But instead of a reference to the child process it returns a Q.promise or undefined
if a callback is passed.
API
var spawn = spawn /** * A windows-compatible spawn method. Succeeds for child exit code === 0. * @param * @param * @param * @param * @returns * * @typedef * @property * @property * 'default' is to capture output and returning it as a string to success (same as exec). * 'ignore' means don't bother capturing it. * 'inherit' means pipe the input & output. This is required for anything that prompts. * @property * @property */; // or // rejectedHandler // resolvedHandler;
Examples
; ;
Todo
- Write tests