Skip to content

Commit cfedf92

Browse files
authored
Merge pull request #157 from 9999years/wiggles/swrv
Don't mangle escapes in `Error::Timeout`
2 parents 3706084 + e6e2bf5 commit cfedf92

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::time;
22

33
#[derive(Debug, thiserror::Error)]
44
pub enum Error {
5-
#[error("EOF (End of File): Expected {} but got EOF after reading \"{}\" process terminated with {:?}", .expected, .got, .exit_code.as_ref().unwrap_or(&"unknown".to_owned()))]
5+
#[error("EOF (End of File): Expected {:?} but got EOF after reading {:?} process terminated with {:?}", .expected, .got, .exit_code.as_ref().unwrap_or(&"unknown".to_owned()))]
66
EOF {
77
expected: String,
88
got: String,
@@ -12,7 +12,7 @@ pub enum Error {
1212
#[error("PipeError")]
1313
BrokenPipe,
1414

15-
#[error("Timeout Error: Expected {} but got \"{}\" (after waiting {} ms)", .expected, .got, (.timeout.as_secs() * 1000) as u32 + .timeout.subsec_millis())]
15+
#[error("Timeout Error: Expected {:?} but got {:?} (after waiting {} ms)", .expected, .got, (.timeout.as_secs() * 1000) as u32 + .timeout.subsec_millis())]
1616
Timeout {
1717
expected: String,
1818
got: String,

src/reader.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,7 @@ impl NBReader {
273273
if start.elapsed() > timeout {
274274
return Err(Error::Timeout {
275275
expected: needle.to_string(),
276-
got: self
277-
.buffer
278-
.clone()
279-
.replace('\n', "`\\n`\n")
280-
.replace('\r', "`\\r`")
281-
.replace('\u{1b}', "`^`"),
276+
got: self.buffer.clone(),
282277
timeout,
283278
});
284279
}

0 commit comments

Comments
 (0)