runsync
Polyfill of spawnSync and execSync for Node-0.10.x (Unix only yet)
Instllation
Requires node-gyp
$ npm install runsync
Usage
var runsync = ;var result = runsync;console; // => Hello world!\n runsync; result = runsync;console; // => Error message\n
API
runsync.spawn(executable, [args], [options])
- Polyfill of child_process.spawnSync.
var res = runsync;console // => 'Hello, World!\n'
runsync.exec(command, [options])
- Polyfill of child_process.execSync.
var output = runsync;// => throw Exception because of timeout
runsync.execFile(command, [options])
- Polyfill of child_process.execFileSync.
var html = runsync;console; // => '<!doctype html>\n<html>\n<head>\n ...'
runsync.popen(command, [options])
- This is similar to
runsync.exec
, but it returns spawn object likesrunsync.spawn
. - This method will not throw Exceptions even if command fails.
var result = runsync;console // => "stdin\n"console // => "stderr\n"
runsync.shell(command, [options])
- This is similar to
runsync.exec
, but always set 'inherit' to options.stdio. - Returns Nothing(undefined).
- This method will throw Exceptions if command fails.
try runsync; // 31 -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_,------, // 1 -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_| /\_/\ // 0 -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-^|__( x .x) // -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- "" "" // 31 passing (468ms) // 1 failing catcherr console; // => 'Command failed: `mocha -u tdd --reporter nyan`'