forked from mirrors/jj
ui: do not write() to channel if builtin pager has terminated
This commit is contained in:
parent
ce2bc8d6b6
commit
f4dd856f9f
2 changed files with 7 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Reference in a new issue