Skip to content

Commit

Permalink
ui: do not write() to channel if builtin pager has terminated
Browse files Browse the repository at this point in the history
  • Loading branch information
yuja committed Aug 5, 2024
1 parent ce2bc8d commit f4dd856
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
* Windows binaries no longer require `vcruntime140.dll` to be installed
(normally through Visual Studio.)

* On quit, the builtin pager no longer waits for all outputs to be discarded.

* `jj branch rename` no longer shows a warning in colocated repos.

## [0.19.0] - 2024-07-03
Expand Down
5 changes: 5 additions & 0 deletions cli/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ impl Write for &BuiltinPager {
}

fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
// Since minus::Pager holds the rx end internally, push_str() doesn't
// fail even after the paging thread gets terminated.
if self.dynamic_pager_thread.is_finished() {
return Err(io::ErrorKind::BrokenPipe.into());
}
let string = std::str::from_utf8(buf).map_err(io::Error::other)?;
self.pager.push_str(string).map_err(io::Error::other)?;
Ok(buf.len())
Expand Down

0 comments on commit f4dd856

Please sign in to comment.