mirror of
https://seed.radicle.dev/rad:z3qg5TKmN83afz2fj9z3fQjU8vaYE.git
synced 2026-11-16 08:20:40 +08:00
feat: format log file to be more markdown
Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
+17
-5
@@ -114,13 +114,13 @@ fn run(
|
||||
.map_err(|e| NativeError::CreateLog(log_filename.into(), e))?,
|
||||
);
|
||||
|
||||
logmsg(log_filename, &mut log, "=== Radicle native CI\n".into())?;
|
||||
logmsg(log_filename, &mut log, "# Radicle native CI\n".into())?;
|
||||
logmsg(
|
||||
log_filename,
|
||||
&mut log,
|
||||
format!("=== Repository id: {}\n", repo),
|
||||
format!("# Repository id: {}\n", repo),
|
||||
)?;
|
||||
logmsg(log_filename, &mut log, format!("=== Commit: {}\n", commit))?;
|
||||
logmsg(log_filename, &mut log, format!("# Commit: {}\n", commit))?;
|
||||
|
||||
write_response(&Response::triggered(RunId::from(
|
||||
run_id.to_string().as_str(),
|
||||
@@ -166,7 +166,6 @@ fn runcmd(
|
||||
argv: &[&str],
|
||||
cwd: &Path,
|
||||
) -> Result<(), NativeError> {
|
||||
logmsg(log_filename, log, format!("=== Run: {:?}\n---\n", argv))?;
|
||||
let mut p = Popen::create(
|
||||
argv,
|
||||
PopenConfig {
|
||||
@@ -177,13 +176,26 @@ fn runcmd(
|
||||
},
|
||||
)
|
||||
.map_err(|e| NativeError::PopenCreate(format!("{:?}", argv), e))?;
|
||||
logmsg(
|
||||
log_filename,
|
||||
log,
|
||||
format!(
|
||||
"# Run command\n\nCommand:\n~~~\n{:?}\n~~~\n\nOutput:\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
|
||||
argv
|
||||
),
|
||||
)?;
|
||||
p.communicate(None)
|
||||
.map_err(|e| NativeError::ChildComms(format!("{:?}", argv), e))?;
|
||||
let exit = p
|
||||
.wait()
|
||||
.map_err(|e| NativeError::PopenFailed(format!("{:?}", argv), e))?;
|
||||
debug!("exit: {:?}", exit);
|
||||
logmsg(log_filename, log, "...\n".into())?;
|
||||
logmsg(
|
||||
log_filename,
|
||||
log,
|
||||
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n\n".into(),
|
||||
)?;
|
||||
|
||||
if !exit.success() {
|
||||
let error = Response::error(&format!("command failed: {:?}", argv));
|
||||
error
|
||||
|
||||
Reference in New Issue
Block a user