Show More
@@ -49,7 +49,7 b' impl Ui {' | |||||
49 | .write_all(bytes) |
|
49 | .write_all(bytes) | |
50 | .or_else(|e| handle_stderr_error(e))?; |
|
50 | .or_else(|e| handle_stderr_error(e))?; | |
51 |
|
51 | |||
52 |
stderr.flush().or_else(|e| |
|
52 | stderr.flush().or_else(|e| handle_stderr_error(e)) | |
53 | } |
|
53 | } | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
@@ -94,3 +94,13 b' fn handle_stdout_error(error: io::Error)' | |||||
94 |
|
94 | |||
95 | Err(UiError::StdoutError(error)) |
|
95 | Err(UiError::StdoutError(error)) | |
96 | } |
|
96 | } | |
|
97 | ||||
|
98 | /// Sometimes writing to stderr is not possible. | |||
|
99 | fn handle_stderr_error(error: io::Error) -> Result<(), UiError> { | |||
|
100 | // A broken pipe should not result in a error | |||
|
101 | // like with `| head` for example | |||
|
102 | if let ErrorKind::BrokenPipe = error.kind() { | |||
|
103 | return Ok(()); | |||
|
104 | } | |||
|
105 | Err(UiError::StdoutError(error)) | |||
|
106 | } |
General Comments 0
You need to be logged in to leave comments.
Login now