diff --git a/tools/release-operator/src/registry.rs b/tools/release-operator/src/registry.rs index 09a0e7944..85b92bbeb 100644 --- a/tools/release-operator/src/registry.rs +++ b/tools/release-operator/src/registry.rs @@ -152,13 +152,11 @@ impl Crate { fn submit(&self, token: &SecUtf8, dry_run: bool) -> anyhow::Result<()> { log::info!("{self} publishing new version"); - let current_dir = std::env::current_dir() - .context("determine current working directory")?; - std::env::set_current_dir(&self.path) - .context("switch working directory to the crate in scope")?; - let mut command = Command::new("cargo"); - command.arg("publish").args(["--token", token.unsecure()]); + command + .arg("publish") + .args(["--token", token.unsecure()]) + .current_dir(&self.path); if dry_run { command.arg("--dry-run"); @@ -177,9 +175,6 @@ impl Crate { } } - std::env::set_current_dir(current_dir) - .context("reset working directory")?; - Ok(()) } }