Coder Social home page Coder Social logo

Comments (5)

elliottsj avatar elliottsj commented on May 14, 2024

👍 Also seeing messy output

from concurrently.

aecz avatar aecz commented on May 14, 2024

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'));    
}

from concurrently.

JuanCaicedo avatar JuanCaicedo commented on May 14, 2024

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

from concurrently.

aecz avatar aecz commented on May 14, 2024

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

from concurrently.

gustavohenke avatar gustavohenke commented on May 14, 2024

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

from concurrently.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.