Reputation: 8066
Is it possible to make nodejs execute some code after it has been launched.
After Node.js started, I hope it can loads some code interprets and executes them.
Is there any module can do this?
Your comment welcome
Upvotes: 0
Views: 48
Reputation: 23370
You might take a look at the child process in the Node API, specifically exec for an easy example of executing a command from within Node.
Copied from the API doc:
var exec = require('child_process').exec,
child;
child = exec('cat *.js bad_file | wc -l',
function (error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
Upvotes: 2