diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-03-17 14:56:44 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-03-17 14:56:44 +0800 |
| commit | 2e11849a23de0533b172fe2bb057fc3553a36cc1 (patch) | |
| tree | dedbb6e269198f3d9039e5a5024964e5d995b7a8 /src/systems/cmd/cmd_system.rs | |
| parent | 775b3613f3ece75f7673ea1be6b6ec420c2bb76b (diff) | |
Handle early command output in prepare phase
Diffstat (limited to 'src/systems/cmd/cmd_system.rs')
| -rw-r--r-- | src/systems/cmd/cmd_system.rs | 16 |
1 files changed, 12 insertions, 4 deletions
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")); |
