Skip to content

Commit 2ee270f

Browse files
authored
Merge pull request #228 from cgwalters/reexec-fix
install: Two smaller fixes
2 parents 1a36314 + d82446a commit 2ee270f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lib/src/cli.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,10 @@ pub(crate) enum Opt {
167167
/// Execute the given command in the host mount namespace
168168
#[cfg(feature = "install")]
169169
#[clap(hide = true)]
170-
#[command(external_subcommand)]
171-
ExecInHostMountNamespace(Vec<OsString>),
172-
170+
ExecInHostMountNamespace {
171+
#[clap(trailing_var_arg = true, allow_hyphen_values = true)]
172+
args: Vec<OsString>,
173+
},
173174
/// Internal integration testing helpers.
174175
#[clap(hide(true), subcommand)]
175176
#[cfg(feature = "internal-testing-api")]
@@ -468,7 +469,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
468469
InstallOpts::ToFilesystem(opts) => crate::install::install_to_filesystem(opts).await,
469470
},
470471
#[cfg(feature = "install")]
471-
Opt::ExecInHostMountNamespace(args) => {
472+
Opt::ExecInHostMountNamespace { args } => {
472473
crate::install::exec_in_host_mountns(args.as_slice())
473474
}
474475
Opt::Status(opts) => super::status::status(opts).await,

lib/src/install.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ pub(crate) fn run_in_host_mountns(cmd: &str) -> Command {
673673

674674
#[context("Re-exec in host mountns")]
675675
pub(crate) fn exec_in_host_mountns(args: &[std::ffi::OsString]) -> Result<()> {
676-
let (cmd, args) = args[1..]
676+
let (cmd, args) = args
677677
.split_first()
678678
.ok_or_else(|| anyhow::anyhow!("Missing command"))?;
679679
tracing::trace!("{cmd:?} {args:?}");
@@ -694,6 +694,7 @@ fn skopeo_supports_containers_storage() -> Result<bool> {
694694
let o = run_in_host_mountns("skopeo").arg("--version").output()?;
695695
let st = o.status;
696696
if !st.success() {
697+
let _ = std::io::copy(&mut std::io::Cursor::new(o.stderr), &mut std::io::stderr()); // Ignore errors copying stderr
697698
anyhow::bail!("Failed to run skopeo --version: {st:?}");
698699
}
699700
let stdout = String::from_utf8(o.stdout).context("Parsing skopeo version")?;

0 commit comments

Comments
 (0)