Package Exports
- spawn-sync
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (spawn-sync) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
spawn-sync
Polyfill for child_process.spawnSync
.
On iojs and node >= 0.12 it will just export the built in child_process.spawnSync
. On platforms that support compiling native modules it uses the thread-sleep module to wait for an output file to exist in a tight loop. In this way it gains excellent cross platform support, but don't expect it to be efficient on all platforms.
Installation
npm install spawn-sync
If this fails, you can try one of two things:
You can install using
--unsafe-perm
, which will fix any permissions issues.npm install --unsafe-perm spawn-sync
You can upgrade to the latest version of node or iojs. This will make native compilation unnecessary.
Usage
var spawnSync = require('spawn-sync');
var result = spawnSync('node',
['filename.js'],
{input: 'write this to stdin'});
// Note, status code will always equal 0 if using busy waiting fallback
if (result.status !== 0) {
process.stderr.write(result.stderr);
process.exit(result.status);
} else {
process.stdout.write(result.stdout);
process.stderr.write(result.stderr);
}
License
MIT