diff --git a/lib/src/cli.rs b/lib/src/cli.rs index eaf724153..764b9408e 100644 --- a/lib/src/cli.rs +++ b/lib/src/cli.rs @@ -156,8 +156,10 @@ pub(crate) enum Opt { /// Execute the given command in the host mount namespace #[cfg(feature = "install")] #[clap(hide = true)] - #[command(external_subcommand)] - ExecInHostMountNamespace(Vec), + ExecInHostMountNamespace { + #[clap(trailing_var_arg = true, allow_hyphen_values = true)] + args: Vec, + }, /// Install to the target filesystem. #[cfg(feature = "install")] InstallToFilesystem(crate::install::InstallToFilesystemOpts), @@ -458,7 +460,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> { #[cfg(feature = "install")] Opt::InstallToFilesystem(opts) => crate::install::install_to_filesystem(opts).await, #[cfg(feature = "install")] - Opt::ExecInHostMountNamespace(args) => { + Opt::ExecInHostMountNamespace { args } => { crate::install::exec_in_host_mountns(args.as_slice()) } Opt::Status(opts) => super::status::status(opts).await, diff --git a/lib/src/install.rs b/lib/src/install.rs index 12de3996f..c54174321 100644 --- a/lib/src/install.rs +++ b/lib/src/install.rs @@ -672,7 +672,7 @@ pub(crate) fn run_in_host_mountns(cmd: &str) -> Command { #[context("Re-exec in host mountns")] pub(crate) fn exec_in_host_mountns(args: &[std::ffi::OsString]) -> Result<()> { - let (cmd, args) = args[1..] + let (cmd, args) = args .split_first() .ok_or_else(|| anyhow::anyhow!("Missing command"))?; let pid1mountns = std::fs::File::open("/proc/1/ns/mnt")?;