Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log result of the command before returning from main #1302

Merged
merged 1 commit into from
Oct 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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