dotfiles/.vscode/extensions/vscodevim.vim-0.2.0/node_modules/sync-exec/js/lib/proxy.js

34 lines
881 B
JavaScript
Raw Normal View History

2016-09-11 09:29:13 +01:00
// Generated by CoffeeScript 1.9.3
(function() {
var child_process;
child_process = require('child_process');
module.exports = function(cmd, max_wait, options) {
var err, orig_write, status, stderr, stdout, t0;
options.timeout = max_wait;
stdout = stderr = '';
status = 0;
t0 = Date.now();
orig_write = process.stderr.write;
process.stderr.write = function() {};
try {
stdout = child_process.execSync(cmd, options);
process.stderr.write = orig_write;
} catch (_error) {
err = _error;
process.stderr.write = orig_write;
if (err.signal === 'SIGTERM' && t0 <= Date.now() - max_wait) {
throw new Error('Timeout');
}
stdout = err.stdout, stderr = err.stderr, status = err.status;
}
return {
stdout: stdout,
stderr: stderr,
status: status
};
};
}).call(this);