spawn() is expected to return an error if the specified file could not be
executed. FreeBSD's posix_spawn() supports returning ENOENT/ENOEXEC if
the exec() fails, which not all platforms support. This brings a very
significant performance improvement for FreeBSD, involving heavy use of
Command in threads, due to fork() invoking jemalloc fork handlers and
causing lock contention. FreeBSD's posix_spawn() avoids this problem
due to using vfork() internally.
io::Error::last_os_error()
}
- #[cfg(not(any(target_os = "linux", target_os = "macos")))]
+ #[cfg(not(any(target_os = "freebsd")))]
fn posix_spawn(&mut self, _stdio: &ChildPipes, _envp: Option<&CStringArray>)
-> io::Result<Option<Process>>
{
Ok(None)
}
- #[cfg(any(target_os = "linux", target_os = "macos"))]
+ #[cfg(any(target_os = "freebsd"))]
fn posix_spawn(&mut self, stdio: &ChildPipes, envp: Option<&CStringArray>)
-> io::Result<Option<Process>>
{