Merge pull request #111 from draios/update-nodejs-example

Don't run the spawned program in a shell.
This commit is contained in:
Mark Stemm 2016-08-09 11:00:07 -07:00 committed by GitHub
commit 03e6c1b3d9

View File

@ -14,8 +14,8 @@ router.get('/', function(req, res) {
}); });
router.get('/exec/:cmd', function(req, res) { router.get('/exec/:cmd', function(req, res) {
var output = child_process.execSync(req.params.cmd); var ret = child_process.spawnSync(req.params.cmd);
res.send(output); res.send(ret.stdout);
}); });
app.use('/api', router); app.use('/api', router);