Skip to content

Commit

Permalink
Log result of the command before returning from main
Browse files Browse the repository at this point in the history
Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com>
  • Loading branch information
YJDoc2 committed Oct 25, 2022
1 parent c794664 commit e8c5d6a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/youki/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fn main() -> Result<()> {
let root_path = determine_root_path(opts.global.root)?;
let systemd_cgroup = opts.global.systemd_cgroup;

match opts.subcmd {
let cmd_result = match opts.subcmd {
SubCommand::Standard(cmd) => match cmd {
StandardCmd::Create(create) => {
commands::create::create(create, root_path, systemd_cgroup)
Expand Down Expand Up @@ -132,7 +132,12 @@ fn main() -> Result<()> {
SubCommand::Completion(completion) => {
commands::completion::completion(completion, &mut app)
}
};

if let Err(ref e) = cmd_result {
log::error!("error in executing command: {:?}", e);
}
cmd_result
}

fn determine_root_path(root_path: Option<PathBuf>) -> Result<PathBuf> {
Expand Down

0 comments on commit e8c5d6a

Please sign in to comment.