gulp-run
gulp-run copied to clipboard
run task hangs if output is too large
If a run task outputs too much data to stdout, it seems to hang with no notices or messages or anything.
Originally I thought it was related to maxBuffer, but it seems childProcess.spawn doesn't use that, so it shouldn't have issues itself.
Here is a test case that will replicate it:
Start with running "gulp test"
var
childProcess = require('child_process'),
gulp = require('gulp'),
run = require('gulp-run');
gulp.task('test', function(done){
var cmd = "gulp test-long";
//This hangs rather quickly (usually at i=49
run(cmd,{
verbosity:3
}).exec();
//This never dies
/*
var subshell = childProcess.spawn('sh', [
'-c', cmd
], {env: process.env});
subshell.stdout.pipe(process.stdout);
subshell.stderr.pipe(process.stderr);
subshell.stderr.pipe(process.stderr);
subshell.once('close', function (code) {
//this is never called
console.log('PROCESS PROPERLY ENDED');
});
//*/
});
gulp.task('test-long', function(done){
var i = 0;
setInterval(function() {
//The longer this is, the sooner it dies.
console.log("LOTS OF STUFF: " + i++);
console.log("--------------------------------------------------------------------------------------------------------------------------------");
console.log("--------------------------------------------------------------------------------------------------------------------------------");
console.log("--------------------------------------------------------------------------------------------------------------------------------");
console.log("--------------------------------------------------------------------------------------------------------------------------------");
console.log("--------------------------------------------------------------------------------------------------------------------------------");
}, 100);
});
I originally reported it incorrectly in #32
I've been fighting the exact same problem for a few hours now. I'm still far from being able to identify the root cause.
I have the same problem. I run "return run('git -C .docs add --all').exec();" - the git command which supposed to commit all changes. If the amount of changed files is huge and output contains a lot of strings than it just hang and discontinue.
Currently appending > /dev/null
to commands to get around this (that's if you don't need the output).