diag: print pipe() error details in service.spawn

This commit is contained in:
Red Bear OS
2026-07-12 11:55:37 +03:00
parent ab0da30613
commit 234ce3ab1a
+8 -1
View File
@@ -47,7 +47,14 @@ impl Service {
}
command.envs(base_envs).envs(&self.envs);
let (mut read_pipe, write_pipe) = io::pipe().unwrap();
let (mut read_pipe, write_pipe) = io::pipe().unwrap_or_else(|e| {
eprintln!("INIT_DIAG: pipe() failed: {} (errno {})", e, e.raw_os_error().unwrap_or(-1));
match std::fs::OpenOptions::new().read(true).open("/scheme/pipe") {
Ok(_f) => eprintln!("INIT_DIAG: /scheme/pipe open ok"),
Err(e2) => eprintln!("INIT_DIAG: /scheme/pipe open failed: {} (errno {})", e2, e2.raw_os_error().unwrap_or(-1)),
}
panic!("pipe() failed in service.spawn for {}: {}", self.cmd, e)
});
unsafe { pass_fd(&mut command, "INIT_NOTIFY", write_pipe.into()) };
let mut child = match command.spawn() {