index.js 539 B

12345678910111213141516171819202122
  1. var log = require('hlogger').createLogger('shell-test');
  2. var child = require('child_process');
  3. function bundleStart(context) {
  4. log.info("Command provider installed");
  5. // Create a bash and transport commands
  6. context.after('core-shell:cmd',(req,res,e) => {
  7. e.wait();
  8. var shcmd = req.cmd + " " + req.args.join(" ");
  9. var proc = child.exec(shcmd);
  10. res.write("\n");
  11. proc.stdout.pipe(res);
  12. proc.stderr.pipe(process.stderr);
  13. proc.on('close',function() {
  14. e.done();
  15. });
  16. });
  17. }
  18. module.exports.bundleStart = bundleStart;