tar: support -f - for stdin/stdout archives#156
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #156 +/- ##
==========================================
+ Coverage 96.59% 96.78% +0.18%
==========================================
Files 9 9
Lines 941 1121 +180
Branches 24 28 +4
==========================================
+ Hits 909 1085 +176
- Misses 31 35 +4
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
GNU tar refuses -cf - when stdout is a tty (to avoid spewing binary). Maybe add aIsTerminal::is_terminal check and erroring out ? |
Fair point, I'll add that. I'll need a few days to learn more about Rust's locking, though! =) |
|
ping ? :) |
|
needs to be rebased, sorry |
|
@sylvestre I was actually just trying to find the other PR I'd sent you - for this I was trying to figure out how the buffering ought to work. I haven't played a lot with efficient stdio in Rust yet. There are a bunch of other places where this could potentially apply. And I swear I sent you a PR for those with a question and I'm not finding it. |
|
no worries :) |
31a23d9 to
05328b1
Compare
When the archive path is "-", read archives from stdin for list and extract, and write archive data to stdout for create. Route create status output to stderr when writing the archive to stdout so verbose output does not corrupt the stream. Add CLI tests for create-to-stdout, list-from-stdin, extract-from-stdin, and the stderr routing cases.
Merging this PR will improve performance by 19.86%
Performance Changes
Tip Curious why this is faster? Comment Comparing |
|
Hi @sylvestre! Sorry about the delay. Your comments caused me to rework it a bit and I think I'm happy with the patch now. I appreciate any feedback you have. |
|
well done! |
When the archive path is "-", read archives from stdin for list and extract, and write archive data to stdout for create.
Route create status output to stderr when writing the archive to stdout so verbose output does not corrupt the stream. Add CLI tests for create-to-stdout, list-from-stdin, extract-from-stdin, and the stderr routing cases.