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

doesn't work in Webstorm run tool #17

Open
urrri opened this issue Mar 15, 2017 · 8 comments
Open

doesn't work in Webstorm run tool #17

urrri opened this issue Mar 15, 2017 · 8 comments

Comments

@urrri
Copy link

urrri commented Mar 15, 2017

I'm not sure this problem is in the package, but it works fine in terminal window and show nothing in "Run" window of Webstorm (I even didn't receive final callback).

@weihong1028
Copy link

same to me

@think2011
Copy link

+1

@hubgit
Copy link

hubgit commented Oct 5, 2017

This is because the plugin is disabled if the output is not a TTY, like WebStorm's Run window.

@hubgit
Copy link

hubgit commented Oct 12, 2017

Here's the upstream discussion in node-progress.

Another library with the same issue (supports-color) fixed this by adding a FORCE_COLOR option.

@hubgit
Copy link

hubgit commented Oct 12, 2017

The same issue is seen when running an application with forever, which redirects the output to a non-TTY stream.

This workaround helps in that case:

  var stream = options.stream;

  if (!stream) {
    stream = process.stderr;

    if (!stream.isTTY) {
      var tty = require('tty').WriteStream.prototype;

      Object.keys(tty).forEach(function (key) {
        process.stderr[key] = tty[key];
      })

      process.stderr.columns = 80;
    }
  }

Unfortunately WebStorm's Run window doesn't support clearing the line, so keeps drawing new progress bars.

@miniskylab
Copy link

+1

@TobbeLino
Copy link

TobbeLino commented Apr 3, 2018

I made it work perfectly in Webstorm's run console (on Windows 10) by adding this TTY-mock before using the progress bar:

if (!process.stdout.isTTY) {
    process.stdout.isTTY = true;
    process.stdout.columns = 80;
    process.stdout.cursorTo = () => { process.stdout.write('\r') };
    process.stdout.clearLine = () => {};
}

And creating the ProgressBar with the option "stream: process.stdout"

The mocked cursorTo()-function enables overwriting the same line so that multiple lines are not rendered (at least on Windows, this must done before writing the actual line, so that's why process.stdout.write('\r') is put in cursorTo() and not in clearLine()))

@ruaneg
Copy link

ruaneg commented Apr 19, 2018

+1

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

No branches or pull requests

6 participants