m19c / gulp-run

Pipe to shell commands in gulp
ISC License
151 stars 25 forks source link

Possible to write output directly to stdout? #51

Closed isochronous closed 7 years ago

isochronous commented 7 years ago

This is on Windows, btw, if that matters.

I'm basically trying to run a console command via gulp, and want to see the output from it printed in the terminal just as if I'd run the command directly. It looks like I can do this by using run.Command but I actually want to do it via gulp. Apologies if this is a basic question, I actually have very little experience with streams outside of gulp boilerplate.

I've tried doing something like

gulp.task('serve', function() {
    return run('polymer serve -o').exec()
        .pipe(process.stdout);
});

But that just throws an error saying "TypeError: Invalid data, chunk must be a string or buffer, not object"

So far, it looks like one solution is to use gulp.dest('path/to/output') and then some more code that reads that output file and outputs it to stdout, but I'm pretty sure that would remove any ANSI color coding that might be included, which is a disadvantage.

So, is there any super-obvious I-should-have-already-seen-this solution to this?

isochronous commented 7 years ago

Yep, this was definitely a super-obvious I-should-have-already-seen-this solution - just pass an options object with 'verbosity':3 to the run commands. In my defense, all of the things I've tested with this have required ctrl-c'ing to quit the process, which seems to prevent the default verbosity level from ever displaying anything.