From 27d83191722833bc8a13739df74a473f7c0752a8 Mon Sep 17 00:00:00 2001 From: reuben olinsky Date: Fri, 31 Jan 2025 23:17:36 -0800 Subject: [PATCH] fix(completion): better handle native errors in completion funcs --- brush-core/src/completion.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/brush-core/src/completion.rs b/brush-core/src/completion.rs index 60357998..8c3d7cc9 100644 --- a/brush-core/src/completion.rs +++ b/brush-core/src/completion.rs @@ -681,7 +681,10 @@ impl Spec { let _ = shell.env.unset(var_name); } - let result = invoke_result?; + let result = invoke_result.unwrap_or_else(|e| { + tracing::warn!(target: trace_categories::COMPLETION, "error while running completion function '{function_name}': {e}"); + 1 // Report back a non-zero exit code. + }); // When the function returns the special value 124, then it's a request // for us to restart the completion process.