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

Clean messy output #2

Closed
kimmobrunfeldt opened this issue Feb 8, 2015 · 5 comments
Closed

Clean messy output #2

kimmobrunfeldt opened this issue Feb 8, 2015 · 5 comments

Comments

@kimmobrunfeldt
Copy link
Contributor

Example of messy output:

[1] ./node_modules/watchify/node_modules/through2/node_modules/xtend
[1] ./node_modules/watchify/no

... Lot of output of [0] process ...

[1] de_modules/through2/node_modules/xtend/.jshintrc

Outputs should be grouped so that lines wouldn't be cut.

@elliottsj
Copy link

👍 Also seeing messy output

@aecz
Copy link
Contributor

aecz commented Nov 10, 2016

I rewrote the logWithPrefix function to have a cleaner output (almost the same as without concurrently).
Basically, you need to have lastChar variable available outside of the function so you know if you are a at the beginning of a new line or not. This covers most of the edge cases when the stdout moves the cursor or delete characters.

var lastChar;

function logWithPrefix(prefix, prefixColor, text, color) {

     if (config.raw) {  
        process.stdout.write(text);
        return;
    }

    text = text.replace(/\u2026/g,'...'); // Ellipsis

    var lines = text.split('\n');
    // Do not bgColor trailing space
    var coloredPrefix = colorText(prefix.replace(/ $/, ''), prefixColor) + ' ';
    var paddedLines = _.map(lines, function(line, index) {
        var coloredLine = color ? colorText(line, color) : line;
        if (index !== 0 && index !== (lines.length - 1)) {
            coloredLine = coloredPrefix + coloredLine;
        }
        return coloredLine;
    });

    if (!lastChar || lastChar == '\n' ){
        process.stdout.write(coloredPrefix);
    }

    lastChar = text[text.length - 1];         

    process.stdout.write(paddedLines.join('\n'));    
}

@JuanCaicedo
Copy link

Has this been fixed, perhaps by the move to node v4? I'm running the latest version of concurrently on node v4.4.5 and don't experience this.

@kimmobrunfeldt @elliottsj what commands were you running? Just wondering if I can repro

@aecz
Copy link
Contributor

aecz commented Jan 9, 2017

Sorry, didnt link the PR. Here it is #70
I included a repo and command lines to reproduce.

@gustavohenke
Copy link
Member

Sorry for the delay on releasing this, folks! Check v3.5.1 🚢

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

No branches or pull requests

5 participants