Running a shell command from gulp

后端 未结 4 1166
小蘑菇
小蘑菇 2020-12-12 18:03

I would like to run a shell command from gulp, using gulp-shell. I see the following idiom being used the gulpfile.

Is this the idiomatic way to run a c

4条回答
  •  爱一瞬间的悲伤
    2020-12-12 18:46

    gulp-shell has been blacklisted. You should use gulp-exec instead, which has also a better documentation.

    For your case it actually states:

    Note: If you just want to run a command, just run the command, don't use this plugin:

    var exec = require('child_process').exec;
    
    gulp.task('task', function (cb) {
      exec('ping localhost', function (err, stdout, stderr) {
        console.log(stdout);
        console.log(stderr);
        cb(err);
      });
    })
    

提交回复
热议问题