From 4313c6005646a53d3cec9d639cede2b5fad221da Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sun, 14 Aug 2022 21:34:33 +0200 Subject: [PATCH] with code --- cuddle_cli/src/actions/mod.rs | 4 ++-- cuddle_cli/src/actions/shell.rs | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cuddle_cli/src/actions/mod.rs b/cuddle_cli/src/actions/mod.rs index 4df62a6..c7fcfcf 100644 --- a/cuddle_cli/src/actions/mod.rs +++ b/cuddle_cli/src/actions/mod.rs @@ -50,7 +50,7 @@ impl CuddleAction { log::trace!("preparing to run action"); - match ShellAction::new( + return match ShellAction::new( self.name.clone(), format!( "{}/scripts/{}.sh", @@ -70,7 +70,7 @@ impl CuddleAction { log::error!("{}", e); Err(e) } - } + }; } CuddleScript::Dagger(_d) => Err(anyhow::anyhow!("not implemented yet!")), } diff --git a/cuddle_cli/src/actions/shell.rs b/cuddle_cli/src/actions/shell.rs index 007353f..cf1631f 100644 --- a/cuddle_cli/src/actions/shell.rs +++ b/cuddle_cli/src/actions/shell.rs @@ -1,4 +1,8 @@ -use std::{env::current_dir, path::PathBuf, process::Command}; +use std::{ + env::current_dir, + path::PathBuf, + process::{Command, ExitStatus}, +}; use crate::model::CuddleVariable; @@ -44,7 +48,16 @@ Starting running shell action: {} })) .spawn()?; - process.wait()?; + let status = process.wait()?; + + match status.code() { + None => { + log::warn!("process exited without code") + } + Some(n) => { + log::info!("process exited with code: {}", n) + } + } log::info!( "