Created
February 9, 2015 19:29
-
-
Save Xstasy/8de8e2065eaaf888ebff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var spawn = require('child_process').spawn; | |
var Run = require('./Run'); | |
module.exports = { | |
Tool: function(tool, args) { | |
try { | |
console.log("Tool ("+tool+") spawn: " + tool + " " + args.split(" ").toString()); | |
var proc = spawn('tools\\' +tool, args.split(" ")); | |
proc.stdout.on('data', function (data) { | |
console.log("Tool ("+tool+") : " + data); | |
}); | |
proc.stderr.on('data', function (data) { | |
console.log("Tool ("+tool+") error: " + data); | |
}); | |
proc.on('close', function (code) { | |
console.log("Tool ("+tool+") exit: " + code); | |
}); | |
} catch (e) { | |
console.log("Tool ("+tool+") fatal: " + code); | |
} | |
} | |
}; | |
Output | |
################################################################### | |
Tool (MediaInfo.exe) spawn: MediaInfo.exe --Version | |
Tool (MediaInfo.exe) : MediaInfo Command line, | |
MediaInfoLib - v0.7.72 | |
events.js:72 | |
throw er; // Unhandled 'error' event | |
^ | |
Error: spawn OK | |
at errnoException (child_process.js:1011:11) | |
at Process.ChildProcess._handle.onexit (child_process.js:802:34) | |
Process finished with exit code 8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment