fix: handle broken pipe in query --interactive (#1314)

query_interactive printed the fzf selection with bare print! macros, which panic on EPIPE. Use the pipe_exit convention introduced for broken pipes in #137 like the rest of the command already does.

The final flush makes the error surface deterministically even if stdout buffering would otherwise defer the failed write to process exit.

Co-authored-by: Mathjk <Mathjk@users.noreply.github.com>
This commit is contained in:
jk
2026-10-02 01:44:48 +05:30
committed by GitHub
co-authored by Mathjk
parent ba4cfa72e6
commit 9a6d2d4cec
+4 -3
View File
@@ -43,13 +43,14 @@ impl Query {
}
};
let stdout = &mut io::stdout();
if self.score {
print!("{selection}");
write!(stdout, "{selection}").pipe_exit("stdout")?;
} else {
let path = selection.get(7..).context("could not read selection from fzf")?;
print!("{path}");
write!(stdout, "{path}").pipe_exit("stdout")?;
}
Ok(())
stdout.flush().pipe_exit("stdout")
}
fn query_list(&self, stream: &mut Stream, now: Epoch) -> Result<()> {