diff --git a/lib/wasix/src/fs/mod.rs b/lib/wasix/src/fs/mod.rs index 163d9fc2b8c..671bcfd65b7 100644 --- a/lib/wasix/src/fs/mod.rs +++ b/lib/wasix/src/fs/mod.rs @@ -462,6 +462,10 @@ impl WasiFs { pub async fn close_all(&self) { // TODO: this should close all uniquely owned files instead of just flushing. + if let Ok(mut map) = self.fd_map.write() { + map.clear(); + } + let to_close = { if let Ok(map) = self.fd_map.read() { map.keys().copied().collect::>() @@ -471,7 +475,7 @@ impl WasiFs { }; let _ = tokio::join!( - // Make sure the STDOUT and STDERR are explicitly flushed + // Make sure the STDOUT and STDERR are explicitely flushed self.flush(__WASI_STDOUT_FILENO), self.flush(__WASI_STDERR_FILENO), async { @@ -481,10 +485,6 @@ impl WasiFs { } } ); - - if let Ok(mut map) = self.fd_map.write() { - map.clear(); - } } /// Will conditionally union the binary file system with this one