From 71b59d0c8d4f9a196363ffc373f2aca21b80afc4 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 31 Oct 2024 09:53:40 -0400 Subject: [PATCH] tar/write: Ensure repofd outlives child spawn Might help with https://github.com/ostreedev/ostree-rs-ext/issues/664 But I didn't manage to reliably reproduce this. --- lib/src/tar/write.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/src/tar/write.rs b/lib/src/tar/write.rs index 29221e9b..67e2efa1 100644 --- a/lib/src/tar/write.rs +++ b/lib/src/tar/write.rs @@ -417,6 +417,8 @@ pub async fn write_tar( let mut c = tokio::process::Command::from(c); c.kill_on_drop(true); let mut r = c.spawn()?; + // Ensure the fd is open until the process is spawned + drop(repofd); tracing::trace!("Spawned ostree child process"); // Safety: We passed piped() for all of these let child_stdin = r.stdin.take().unwrap();