Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run task hangs if output is too large #34

Open
phazei opened this issue Jul 24, 2015 · 3 comments
Open

run task hangs if output is too large #34

phazei opened this issue Jul 24, 2015 · 3 comments
Labels

Comments

@phazei
Copy link
Contributor

phazei commented Jul 24, 2015

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

@louisremi
Copy link

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.

@vtkalek
Copy link

vtkalek commented Aug 24, 2015

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.

@m19c m19c added the bug label Feb 4, 2016
@damonmaria
Copy link

Currently appending > /dev/null to commands to get around this (that's if you don't need the output).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants