ipc-channel
ipc-channel copied to clipboard
One-shot server hangs indefinetely if client process died
Code looks like this:
let (server, server_name) = IpcOneShotServer::new().unwrap();
let mut child = Command::new(ciri_path)
.arg("--log")
.arg(ciri_logging_level)
.arg("--server")
.arg(server_name)
.arg("discover")
.arg(entry.path())
.env("CIRI_FIXTURE_DIR", ciri_fixture_dir)
.env("RUST_BACKTRACE", "1")
.spawn()
.unwrap();
let (_, (suite_name, test_name)): (_, (String, String)) =
server.accept().unwrap();
child.wait().unwrap();
My child panics in the main thread and dies w/o sending anything. This code then hangs on server.accept().
Is it expected? Should I take care of it on my side?
Given that ipc-channel has no timeouts for receiving, this looks like expected behaviour.
@jdm: Do we want to add this feature?
If there's a way to prevent it, I would be open to accepting a pull request.