stringsext icon indicating copy to clipboard operation
stringsext copied to clipboard

Redirecting output to a program like `head` causes a panic

Open Priw8 opened this issue 6 months ago • 1 comments

$ RUST_BACKTRACE=1 stringsext input-file | head

Results in the following once it tries to print the 11th line:

thread '<unnamed>' panicked at /home/priw8/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stringsext-2.3.4/src/main.rs:165:37:
Error: Can not sent result through output channel. Write permissions? Is there enough space? : SendError { .. }
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: <F as scoped_threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'main' panicked at /home/priw8/.cargo/registry/src/index.crates.io-6f17d22bba15001f/scoped_threadpool-0.1.9/src/lib.rs:236:13:
Thread pool worker panicked
stack backtrace:
   0: std::panicking::begin_panic
   1: scoped_threadpool::Scope::join_all
   2: scoped_threadpool::Pool::scoped
   3: stringsext::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I guess head stops accepting any input once it gets the amount of lines it wants. stringsext could probably exit gracefully once the output becomes unwritable

Priw8 avatar Aug 23 '24 13:08 Priw8