We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 61895e3 commit 44e1e4dCopy full SHA for 44e1e4d
1 file changed
crates/vm/src/stdlib/io.rs
@@ -39,7 +39,18 @@ impl ToPyException for std::io::Error {
39
}
40
self.to_string()
41
};
42
- #[cfg(not(windows))]
+ #[cfg(unix)]
43
+ let msg = {
44
+ let ptr = unsafe { libc::strerror(errno) };
45
+ if !ptr.is_null() {
46
+ unsafe { std::ffi::CStr::from_ptr(ptr) }
47
+ .to_string_lossy()
48
+ .into_owned()
49
+ } else {
50
+ self.to_string()
51
+ }
52
+ };
53
+ #[cfg(not(any(windows, unix)))]
54
let msg = self.to_string();
55
56
#[allow(clippy::let_and_return)]
0 commit comments