diff options
| author | Paweł Palenica <pawelpalenica11@gmail.com> | 2021-07-20 22:17:26 -0700 |
|---|---|---|
| committer | Paweł Palenica <pawelpalenica11@gmail.com> | 2021-07-20 22:17:26 -0700 |
| commit | 0cabc5f11291da1814abbf4ce68676b4d338f43a (patch) | |
| tree | 79a379d81d5cb65e7c42d0e83f85a748a9c240e5 | |
| parent | Minor fixes (diff) | |
| download | sl0ppij-0cabc5f11291da1814abbf4ce68676b4d338f43a.tar.gz sl0ppij-0cabc5f11291da1814abbf4ce68676b4d338f43a.tar.xz sl0ppij-0cabc5f11291da1814abbf4ce68676b4d338f43a.zip | |
Read from LoggingPipe returns error
| -rw-r--r-- | zellij-server/src/logging_pipe.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/zellij-server/src/logging_pipe.rs b/zellij-server/src/logging_pipe.rs index a2658cf9..f1fae6b8 100644 --- a/zellij-server/src/logging_pipe.rs +++ b/zellij-server/src/logging_pipe.rs @@ -41,13 +41,11 @@ impl LoggingPipe { } impl Read for LoggingPipe { - fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> { - // NOTE: should we do this? I think if anyone were to chain LoggingPipe and read from it, - // they would see very weird behavior because we drain self.buffer in `flush`. Also, logs would be screwed up. - // Consider removing this code. - let amt = std::cmp::min(buf.len(), self.buffer.len()); - let data: Vec<_> = self.buffer.drain(..amt).collect(); - buf.as_mut().write(&data) + fn read(&mut self, _: &mut [u8]) -> std::io::Result<usize> { + Err(std::io::Error::new( + std::io::ErrorKind::Other, + "Can not reed from a LoggingPipe", + )) } } |
