I have a gulp-run task to run an .exe with arguments
var gulp = require("gulp");
var run = require('gulp-run');
gulp.task("browserstack", function (done) {
run("BrowserStackLocal.exe fooo localhost,4200,0").exec().pipe(gulp.dest('output'));
});
This works fine, and I get output:
gulp browserstack [10:08:36] Using gulpfile C:\bar\gulpfile.js [10:08:36] Starting 'browserstack'...
But the .exe is long running and has it's own output to stdout in the meantime. When I run it from the command line (without gulp) it says something like "running, press cntrl-c to stop". What I'm doing is waiting for it to finish and then writing it to file, which isn't quite right.
How do I make it pipe the output to my gulp command line as it runs?
Was a duplicate, here is my (windows-only) solution though:
gulp.task("browserstacklocal", function () {
var bslocal = spawn('BrowserStackLocal.exe', ['foo', 'localhost,4200,0']);
bslocal.stdout.on('data', function (data) {
console.log('stdout: ' + data.toString());
});
bslocal.stderr.on('data', function (data) {
console.log('stderr: ' + data.toString());
});
bslocal.on('exit', function (code) {
console.log('child process exited with code ' + code.toString());
});
});