You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently this line causes the progress to be sent on the same line. While this works fine for TTYs it causes headaches for programs that spawn a fork for zstd. Since this is rewriting the same line every time it sometimes can cause stderr to not be triggered with the data.
For instance using child_process's spawn from Nodejs.
constspawn=require('node:child_process').spawn;constexec=spawn('zstd',['-4','test.tar']);exec.stderr.on((data)=>{// Only fired once at the end of executionconsole.log(data.toString());});
This only ever logs the final output of test.tar : 83.16% (1067089920 => 887358325 bytes, test.tar.zst) which is unhelpful for progress tracking.
Describe the solution you'd like
Please add a flag that allows plain progress output. Something that just posts the progress on a new line each update.
Describe alternatives you've considered
I've attempted to use a few tricks, such as using ReadLine.createInterface and a fake TTY.
The text was updated successfully, but these errors were encountered:
If I understand correctly,
you want to update your user interface with notifications that help your end user visualize progress,
and to do that you are relying on parsing the output of the zstd command line utility.
Now your issue is that the zstd command line program uses in-place updates, aka overwrites the same line, in order to present a stable output for its own console interface. Since it's not a new line, parsing isn't naturally accomplished by baseline NodeJS console parser(s) which mostly expect reacting to new line '\n' events.
The requested option would be to change the behavior of zstd by making it write one new line per update event.
While this is technically possible, it's not a good reason enough: it also matters to look around in the ecosystem to understand what's generally expected in similar circumstances.
In this case, in-place updates are becoming common among command line utilities. One can think of pv, wget, curl, dd, git, rsync, and more. All these command line programs display a compact in-place update interface.
None of them provide a flag to output one line per update event, as requested here.
And that makes me wonder if this is the right thing to do.
As mentioned, it's not that there aren't solutions. There are myriads of solutions. It's more a matter of what's the established convention if there is, which responsibility is supposed to be carried by which layer.
Fortunately, a Graphical overlay on top of a command line tool which uses in-place notifications is not something new.
For example, there are several such overlays for wget.
Looking around, a common approach seems to use node-pty.
For example:
Is your feature request related to a problem? Please describe.
Currently this line causes the progress to be sent on the same line. While this works fine for TTYs it causes headaches for programs that spawn a fork for
zstd
. Since this is rewriting the same line every time it sometimes can cause stderr to not be triggered with the data.For instance using child_process's
spawn
from Nodejs.This only ever logs the final output of
test.tar : 83.16% (1067089920 => 887358325 bytes, test.tar.zst)
which is unhelpful for progress tracking.Describe the solution you'd like
Please add a flag that allows plain progress output. Something that just posts the progress on a new line each update.
Describe alternatives you've considered
I've attempted to use a few tricks, such as using
ReadLine.createInterface
and a fake TTY.The text was updated successfully, but these errors were encountered: