31 lines
No EOL
568 B
JavaScript
31 lines
No EOL
568 B
JavaScript
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; |