From 2e11849a23de0533b172fe2bb057fc3553a36cc1 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Tue, 17 Mar 2026 14:56:44 +0800 Subject: Handle early command output in prepare phase --- src/systems/cmd/cmd_system.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/systems/cmd/cmd_system.rs') diff --git a/src/systems/cmd/cmd_system.rs b/src/systems/cmd/cmd_system.rs index 7272c9e..43d5187 100644 --- a/src/systems/cmd/cmd_system.rs +++ b/src/systems/cmd/cmd_system.rs @@ -134,10 +134,18 @@ where Self::collect(&parsed_args, &ctx) ) { Ok((input, collect)) => (input, collect), - Err(e) => { - error!("{}", t!("verbose.cmd_process_prepare_failed")); - return Err(CmdProcessError::from(e)); - } + Err(e) => match e { + CmdPrepareError::EarlyOutput(any_output) => { + // Early output is not an "error" + // It's just that when the result can be determined early, + // there's no need to wait until the execution phase to inform the user + return Ok(any_output); + } + _ => { + error!("{}", t!("verbose.cmd_process_prepare_failed")); + return Err(CmdProcessError::from(e)); + } + }, }; info!("{}", t!("verbose.cmd_process_exec")); -- cgit