From 9ae6a561a06bdccf40dd51c6dfd764bba4aba3cf Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 26 Jan 2023 16:10:19 -0700 Subject: [PATCH] fix command output not being displayed for short lived commands repro with: ``` wezterm --config 'exit_behavior="Hold"' start ls ``` --- docs/changelog.md | 2 ++ mux/src/lib.rs | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index 02901a587..eac9295aa 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -92,6 +92,8 @@ As features stabilize some brief notes about them will accumulate here. [#2991](https://github.com/wez/wezterm/issues/2991) * X11: always update selection owner even if our window already owns it [#2926](https://github.com/wez/wezterm/issues/2926) +* command output would not be displayed if the command exited almost + immediately after starting up. #### Changed * `CTRL-SHIFT-P` now activates the new command palette, instead of `PaneSelect` diff --git a/mux/src/lib.rs b/mux/src/lib.rs index 51b335d81..45180f8f5 100644 --- a/mux/src/lib.rs +++ b/mux/src/lib.rs @@ -197,6 +197,14 @@ fn parse_buffered_data(pane: Arc, dead: &Arc, mut rx: File } } } + + // Don't forget to send anything that we might have buffered + // to be displayed before we return from here; this is important + // for very short lived commands so that we don't forget to + // display what they displayed. + if !actions.is_empty() { + send_actions_to_mux(&pane, std::mem::take(&mut actions)); + } } fn set_socket_buffer(fd: &mut FileDescriptor, option: i32, size: usize) -> anyhow::Result<()> { @@ -277,6 +285,7 @@ fn read_from_pane_pty( } Ok(size) => { histogram!("read_from_pane_pty.bytes.rate", size as f64); + log::trace!("read_pty pane {pane_id} read {size} bytes"); if let Err(err) = tx.write_all(&buf[..size]) { error!( "read_pty failed to write to parser: pane {} {:?}",