summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2024-01-15 13:13:59 +0200
committerLars Wirzenius <liw@liw.fi>2024-01-15 14:41:27 +0200
commitbd74aeeccc0928c5124416cc1232cb9585070985 (patch)
treef6d3f8c1752f9c062a220d80c209642f6bc36075
parentc949db7e6f2418ff141de61c69d9d12ac21de960 (diff)
downloadradicle-native-ci-bd74aeeccc0928c5124416cc1232cb9585070985.tar.gz
feat: show absolute path name for runcmd "in directory"
This is more helpful than ".". Signed-off-by: Lars Wirzenius <liw@liw.fi>
-rw-r--r--src/runcmd.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/runcmd.rs b/src/runcmd.rs
index da99058..1674a5d 100644
--- a/src/runcmd.rs
+++ b/src/runcmd.rs
@@ -1,4 +1,7 @@
-use std::{path::Path, process::Command};
+use std::{
+ path::{Path, PathBuf},
+ process::Command,
+};
use radicle_ci_broker::msg::{MessageError, Response};
@@ -18,7 +21,8 @@ pub fn runcmd(run_log: &mut RunLog, argv: &[&str], cwd: &Path) -> Result<(), Run
run_log.runcmd(
argv,
- cwd,
+ &cwd.canonicalize()
+ .map_err(|e| RunCmdError::Canonicalize(cwd.into(), e))?,
exit.code().unwrap(),
&output.stdout,
&output.stderr,
@@ -50,4 +54,7 @@ pub enum RunCmdError {
#[error("command failed with exit code {0}: {1:?}")]
CommandFailed(i32, Vec<String>),
+
+ #[error("failed to make pathname absolute: {0}")]
+ Canonicalize(PathBuf, #[source] std::io::Error),
}