summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2021-01-31 21:11:22 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2021-01-31 22:48:45 +0100
commit8be5df459a676555573e81b168589c54c4f5ba45 (patch)
treea4629b663d8b8ee035bb176c34a122d4ed62fc58 /src
parent4ca702e1ec9a820c89ba68b97b42509dfce8059d (diff)
downloadrebel-8be5df459a676555573e81b168589c54c4f5ba45.tar
rebel-8be5df459a676555573e81b168589c54c4f5ba45.zip
prepared_command: close pipe read FD in parent, assert close success
Diffstat (limited to 'src')
-rw-r--r--src/prepared_command.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/prepared_command.rs b/src/prepared_command.rs
index 00d648e..39b22ea 100644
--- a/src/prepared_command.rs
+++ b/src/prepared_command.rs
@@ -25,7 +25,7 @@ pub struct PreparedCommand {
impl Drop for PreparedCommand {
fn drop(&mut self) {
- let _ = unistd::close(self.pipew);
+ assert!(unistd::close(self.pipew).is_ok());
}
}
@@ -54,7 +54,9 @@ impl PreparedCommandBuilder {
unsafe {
match unistd::fork().to_io_result()? {
unistd::ForkResult::Parent { child } => {
- return Ok(PreparedCommand { child, pipew });
+ let cmd = PreparedCommand { child, pipew };
+ assert!(unistd::close(piper).is_ok());
+ return Ok(cmd);
}
unistd::ForkResult::Child => {}
}