Gulp – How Can I Open A New Tab In Terminal?

好久不见. 提交于 2019-12-02 08:30:24

问题


I know little about OSX's Terminal, but I'd like to automatically open tabs in terminal via gulp, and then run gulp commands in them using something like gulp-shell. For instance, I'd like to have one gulp task that launches mongoDB in on terminal tab, and launches my app in another tab. How can I do this?


回答1:


I had similar issue, I had to start mongodb and then scala server. Take a look on this answer, it helped me. Running a command with gulp to start Node.js server

var exec = require('child_process').exec;
gulp.task('server', function (cb) {
  exec('node lib/app.js', function (err, stdout, stderr) {
    console.log(stdout);
    console.log(stderr);
    cb(err);
  });
  exec('mongod --dbpath ./data', function (err, stdout, stderr) {
    console.log(stdout);
    console.log(stderr);
    cb(err);
  });
})


来源:https://stackoverflow.com/questions/26175150/gulp-how-can-i-open-a-new-tab-in-terminal

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!