Skip to content

Commit 70977fb

Browse files
committed
Avoid allocating in pre_exec closure
1 parent 9dee271 commit 70977fb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

feos/services/vm-service/src/vmm/ch_adapter.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use hyperlocal::{UnixClientExt, UnixConnector, Uri as HyperlocalUri};
2222
use log::{error, info, warn};
2323
use nix::sys::signal::{kill, Signal};
2424
use nix::unistd::{self, Pid};
25-
use std::io;
2625
use std::path::{Path, PathBuf};
2726
use std::sync::Arc;
2827
use tokio::process::Command as TokioCommand;
@@ -269,7 +268,10 @@ impl Hypervisor for CloudHypervisorAdapter {
269268
TokioCommand::new(&self.ch_binary_path)
270269
.arg("--api-socket")
271270
.arg(&api_socket_path)
272-
.pre_exec(|| unistd::setsid().map(|_pid| ()).map_err(io::Error::other))
271+
.pre_exec(|| {
272+
unistd::setsid()?;
273+
Ok(())
274+
})
273275
.spawn()
274276
}
275277
.map_err(|e| VmmError::ProcessSpawnFailed(e.to_string()))?;

0 commit comments

Comments
 (0)