Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/muvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ procfs = { version = "0.18.0", default-features = false, features = [] }
rustix = { version = "0.38.34", default-features = false, features = ["fs", "mount", "process", "pty", "std", "stdio", "system", "termios", "use-libc-auxv"] }
serde = { version = "1.0.203", default-features = false, features = ["derive"] }
serde_json = { version = "1.0.117", default-features = false, features = ["std"] }
shell-words = { version = "1.1.1", default-features = false, features = ["std"] }
tempfile = { version = "3.10.1", default-features = false, features = [] }
tokio = { version = "1.38.0", default-features = false, features = ["io-util", "macros", "net", "process", "rt-multi-thread", "sync"] }
tokio-stream = { version = "0.1.15", default-features = false, features = ["net", "sync"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/muvm/src/bin/muvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ fn main() -> Result<ExitCode> {
.context("Failed to connect to `passt`")?
.into()
} else {
start_passt(&options.publish_ports)
start_passt(&options.publish_ports, &options.passt_args)
.context("Failed to start `passt`")?
.into()
};
Expand Down
11 changes: 11 additions & 0 deletions crates/muvm/src/cli_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub struct Options {
pub mem: Option<MiB>,
pub vram: Option<MiB>,
pub passt_socket: Option<PathBuf>,
pub passt_args: Vec<String>,
pub fex_images: Vec<String>,
pub merged_rootfs: bool,
pub interactive: bool,
Expand Down Expand Up @@ -135,6 +136,15 @@ pub fn options() -> OptionParser<Options> {
.help("Instead of starting passt, connect to passt socket at PATH")
.argument("PATH")
.optional();
let passt_args = long("passt-args")
.help(
"When starting passt, append the given arguments.
May contain shell-quoted args, like so: --passt-args '-l \"my log file.txt\"'",
)
.argument::<String>("ARGS")
.parse(|s| shell_words::split(&s))
.many()
.map(|nested| nested.into_iter().flatten().collect());
let interactive = long("interactive")
.short('i')
.help("Attach to the command's stdin/out after starting it")
Expand Down Expand Up @@ -192,6 +202,7 @@ pub fn options() -> OptionParser<Options> {
mem,
vram,
passt_socket,
passt_args,
fex_images,
merged_rootfs,
interactive,
Expand Down
5 changes: 4 additions & 1 deletion crates/muvm/src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ where
Ok(UnixStream::connect(passt_socket_path)?)
}

pub fn start_passt(publish_ports: &[String]) -> Result<UnixStream> {
pub fn start_passt(publish_ports: &[String], passt_args: &[String]) -> Result<UnixStream> {
// SAFETY: The child process should not inherit the file descriptor of
// `parent_socket`. There is no documented guarantee of this, but the
// implementation as of writing atomically sets `SOCK_CLOEXEC`.
Expand Down Expand Up @@ -112,6 +112,9 @@ pub fn start_passt(publish_ports: &[String]) -> Result<UnixStream> {
for spec in publish_ports {
cmd.args(PublishSpec::parse(spec)?.to_args());
}
for arg in passt_args {
cmd.arg(arg);
}
let child = cmd.spawn();
if let Err(err) = child {
return Err(err).context("Failed to execute `passt` as child process");
Expand Down
Loading