Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use posix error message for unix
  • Loading branch information
youknowone committed Dec 12, 2025
commit 44e1e4d412e2a7814d81a36ef28ff374f939febb
13 changes: 12 additions & 1 deletion crates/vm/src/stdlib/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,18 @@ impl ToPyException for std::io::Error {
}
self.to_string()
};
#[cfg(not(windows))]
#[cfg(unix)]
let msg = {
let ptr = unsafe { libc::strerror(errno) };
if !ptr.is_null() {
unsafe { std::ffi::CStr::from_ptr(ptr) }
.to_string_lossy()
.into_owned()
} else {
self.to_string()
}
};
#[cfg(not(any(windows, unix)))]
let msg = self.to_string();

#[allow(clippy::let_and_return)]
Expand Down