问题
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