node-ipc/node_modules/node-cmd/cmd.js

31 lines
568 B
JavaScript
Raw Normal View History

2014-09-03 16:25:35 +10:00
var sys = require('sys'),
exec = require('child_process').exec;
var commandline={
get:getString,
run:runCommand
};
function runCommand(command){
exec(
command
);
}
function getString(command,callback){
exec(
command,
(
function(){
return function(err,data,stderr){
if(!callback)
return;
callback(data);
}
}
)(callback)
);
}
module.exports=commandline;