node-progress icon indicating copy to clipboard operation
node-progress copied to clipboard

Progress bar won't render when redirecting output to a file

Open jainanshul opened this issue 8 years ago • 4 comments

I have a node program that used progress bar to display the progress of various long running operations. I redirect the output to a file to be viewed later but the no information about the progress bar is being stored in the file. I only see empty new lines instead of progress bar. I don't expect the progress bar to show the progress bar itself but if it can at least write the progress percentage in the file it would really help.

jainanshul avatar Aug 28 '17 17:08 jainanshul

Probably because this module works only with a writable stream in a text terminal (tty) context.

Check lib/node-progress.js#L126

if (!this.stream.isTTY) return;

roccomuso avatar Oct 04 '17 14:10 roccomuso

But if you comment that line out you get the error seen here: https://github.com/visionmedia/node-progress/issues/166

Or, at least I do. So I am wondering if there is a workaround. I am basically just using tee to capture this to a log. I don't need the log to be pretty.

db-ryan avatar Dec 08 '17 22:12 db-ryan

The fix in this issue works:

https://github.com/visionmedia/node-progress/issues/110

I will try to work on a PR that includes this as a forced option.

db-ryan avatar Dec 08 '17 22:12 db-ryan

I made the PR to add this as an option: https://github.com/visionmedia/node-progress/pull/168

ryan-frankel avatar Dec 11 '17 19:12 ryan-frankel