Skip to content

Instantly share code, notes, and snippets.

Created March 1, 2018 02:11
Show Gist options
  • Save anonymous/ecf20b474c85f797d025094c1b9cfef9 to your computer and use it in GitHub Desktop.
Save anonymous/ecf20b474c85f797d025094c1b9cfef9 to your computer and use it in GitHub Desktop.
diff --git a/src/libstd/sys/unix/process/process_unix.rs b/src/libstd/sys/unix/process/process_unix.rs
index d66c237514..76397aef94 100644
--- a/src/libstd/sys/unix/process/process_unix.rs
+++ b/src/libstd/sys/unix/process/process_unix.rs
@@ -327,7 +327,11 @@ impl Command {
if ret == 0 {
Ok(Some(p))
} else {
- Err(io::Error::last_os_error())
+ Err(if cfg!(target_os = "macos") {
+ io::Error::from_raw_os_error(ret)
+ } else {
+ io::Error::last_os_error()
+ })
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment