kamiyo / multi-progress-bars

A multi progress bar library for CLI, with support for indefinite task spinners
MIT License
27 stars 4 forks source link

when stream=process.stderr and stdout is not a TTY, the MPB UI does not update-in-place, and has no colors #7

Closed starpit closed 3 years ago

starpit commented 3 years ago

If you update examples/exampleBottom.ts to add stream: process.stderr to the new MultiProgressBar() constructor, and then run this example in a situation where stdout is not a TTY, e.g.

node bottomInput.js > /dev/null

then the MultiProgressBar UI does not update in place. Instead every increment/update call results in the console scrolling. There seems to be some garbage "aN;H" added to every newline --- even though i expect no newlines.

Is it possible there a bug where the cursor control characters are always sent to stdout, even if stream is stderr? I haven't looked at your code yet to see.

starpit commented 3 years ago

All I can see so far is in src/virtual-console.ts, https://github.com/kamiyo/multi-progress-bars/blob/master/src/virtual-console.ts#L86-L87

Those lines refer to process.stdout, independent of whether or not stdout is actually a TTY.

kamiyo commented 3 years ago

Ah yes, I was mostly building this for myself and didn't consider non-TTY stdout. I'll take a look at your PR. Thanks.

On Wed, Apr 14, 2021, 20:18 Nick Mitchell @.***> wrote:

All I can see so far is in src/virtual-console.ts, https://github.com/kamiyo/multi-progress-bars/blob/master/src/virtual-console.ts#L86-L87

Those lines refer to process.stdout, independent of whether or not stdout is actually a TTY.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kamiyo/multi-progress-bars/issues/7#issuecomment-819950162, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWCYT3WUEEOHH5HLGPSJX3TIY5GDANCNFSM426OJ3SQ .

kamiyo commented 3 years ago

Thanks for the PR - merged and published as v3.2.4