summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Otto <th1000s@posteo.net>2024-12-02 23:21:08 +0100
committerDan Davison <dandavison7@gmail.com>2024-12-02 18:19:41 -0500
commit440cdd35dcdab4dc6c00231935411910be628983 (patch)
tree9e78bd20424d54d780746265eade4f37067883e8
parent31296e7ff72eedf1f3781d5a4f5f807229a92990 (diff)
Don't keep subcommand stdout around
take() and pass it to BufReader so it gets closed when the reader stops. Otherwise on an early pager (EPIPE), and thus delta() exit the feeding subcommand still has an open stdout to write something into and wait()-ing on it hangs.
-rw-r--r--src/main.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 5080dd3..e952a3b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -228,7 +228,7 @@ pub fn run_app(
let cmd_stdout = cmd
.stdout
- .as_mut()
+ .take()
.unwrap_or_else(|| panic!("Failed to open stdout"));
let cmd_stdout_buf = io::BufReader::new(cmd_stdout);