in #13720 we have an error that has some text after the os error, thus when we use strip_errno() on it, we lose the text after it
mktemp: Permission denied (os error 13) at path "/tmp.haKXBI6xNU" becomes mktemp: Permission denied.
we can do something like
pub fn strip_errno(err: &std::io::Error) -> String {
let msg = err.to_string();
if let Some((before, rest)) = msg.split_once(" (os error ") {
if let Some((_, after)) = rest.split_once(')') {
return format!("{}{}", before, after);
}
}
msg
}
which passes all the rust tests
in #13720 we have an error that has some text after the os error, thus when we use strip_errno() on it, we lose the text after it
mktemp: Permission denied (os error 13) at path "/tmp.haKXBI6xNU"becomesmktemp: Permission denied.we can do something like
which passes all the rust tests