Skip to content

Commit f2ea442

Browse files
committed
Avoid allocating in pre_exec closure
1 parent 2d797c5 commit f2ea442

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/subprocess.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn spawn_process(cmd: &str, args: &[&str]) -> io::Result<()> {
1111
// Safety: libc::daemon() is async-signal-safe
1212
unsafe {
1313
proc.pre_exec(|| match libc::daemon(0, 0) {
14-
-1 => Err(io::Error::other("Failed to detach new process")),
14+
-1 => Err(io::Error::last_os_error()),
1515
_ => Ok(()),
1616
});
1717
}

0 commit comments

Comments
 (0)