Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional spawn sync #18

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ var fs = require('fs');
var path = require('path');
var cp = require('child_process');
var LRU = require('lru-cache');
var sync = require('spawn-sync');

try {
var sync = require('spawn-sync');
} catch (e) {}

var isWin = process.platform === 'win32';
var shebangCache = LRU({ max: 50, maxAge: 30 * 1000 });
Expand Down Expand Up @@ -117,6 +120,9 @@ function spawn(command, args, options) {
}

function spawnSync(command, args, options) {
if (!sync) {
throw new Error('spawn-sync not installed.');
}
return spawnInternal(sync, command, args, options);
}

Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
"author": "IndigoUnited <hello@indigounited.com> (http://indigounited.com)",
"license": "MIT",
"dependencies": {
"lru-cache": "^2.5.0",
"lru-cache": "^2.5.0"
},
"optionalDependencies": {
"spawn-sync": "^1.0.6"
},
"devDependencies": {
Expand Down