简体   繁体   中英

Gulp-Shell is not executing any commands

I'm trying to execute something using gulp-shell . My gulfile.js contains the following content:

var gulp  = require('gulp'),
    shell = require('gulp-shell');

gulp.task('test', function() {
  shell(['echo test']);
});

Then I run it calling gulp test . This is the output I get:

Using gulpfile ~/gulpfile.js
Starting 'test'...
Finished 'test' after 2.62 ms

There's no output for my echo call.

I'm using an Ubuntu 14 VM that I connected to, using Putty .

Anyone got an idea what's wrong?

That's because it's not the good way to use gulp-shell.

Try this, as seen in the gulp-shell README .

var gulp  = require('gulp'),
    shell = require('gulp-shell');

gulp.task('test', shell.task([
    'echo test'
]));

For the record, if you want to pipe gulp-shell, per specified in the doc :

gulp.task('myGulpTask', [], function() {
  return gulp.src('gulpfile.js', {read: false})
    .pipe(shell('echo "This works too"'));
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM