Skip to content

Commit

Permalink
Fixed deadlock when command errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rben01 committed Dec 11, 2024
1 parent a7a93c9 commit fdbbb3b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions numbat-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,11 @@ impl Cli {

rl.add_history_entry(&line)?;

let mut ctx = self.context.lock().unwrap();
match cmd_runner.try_run_command(
&line,
CommandContext {
ctx: &mut self.context.lock().unwrap(),
ctx: &mut ctx,
editor: rl,
},
) {
Expand All @@ -383,10 +384,11 @@ impl Cli {
CommandControlFlow::NotACommand => {}
},
Err(err) => {
self.context.lock().unwrap().print_diagnostic(*err);
ctx.print_diagnostic(*err);
continue;
}
}
drop(ctx);

let ParseEvaluationOutcome {
control_flow,
Expand Down

0 comments on commit fdbbb3b

Please sign in to comment.