facebook / facebook/zstd

Add a flag for plain progress

Open
#4,337 1 comment 0 reactions 1 assignee Claimed by @Cyan4973 View on GitHub
Dominant language
C
Stars
27.9k
Forks
2.6k
Avg merge
1d 3h
Merged PRs (30d)
8

Description

**Is your feature request related to a problem? Please describe.**
Currently [this](https://github.com/facebook/zstd/blob/f9a6031963dee08620855545bdad7d519c208e8a/programs/fileio.c#L1683C17-L1683C96) 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.
```js
const spawn = require('node:child_process').spawn;

const exec = spawn('zstd', ['-4', 'test.tar']);

exec.stderr.on((data) => {
// Only fired once at the end of execution
console.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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.