diff options
Diffstat (limited to 'scripts/lib/system.js')
-rw-r--r-- | scripts/lib/system.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/lib/system.js b/scripts/lib/system.js new file mode 100644 index 00000000..1a276f8b --- /dev/null +++ b/scripts/lib/system.js @@ -0,0 +1,27 @@ +(function() { + Object.defineProperties(system, { + "spawn" : + { + value : (function() { + return function(command, onStdout, onStderr, stdin, environ) { + var stdout, stderr; + return system._spawn(command, + !onStdout ? null : function(response) { + var ret; + stdout = onStdout.call(onStdout, response) || response; + }, + !onStderr ? null : function(response) { + var ret; + stderr = onStderr.call(onStderr, response) || response; + return ret; + }, + stdin, environ).then( + function() { return stdout; }, + function() { return stdin; } + ); + }; + })() + } + }); + Object.freeze(system); +})(); |