diff --git a/src/rules/command_not_found.rs b/src/rules/command_not_found.rs index 5ff13a0..e3a7f37 100644 --- a/src/rules/command_not_found.rs +++ b/src/rules/command_not_found.rs @@ -50,7 +50,7 @@ fn command_not_found_impl( } fn detect_command(cmd: &[String], error: &str) -> Option { - let regex_bash = Regex::new(r"bash: ([^\s]+): command not found(...)?").unwrap(); + let regex_bash = Regex::new(r"bash:(?: line \d+:)? ([^\s]+): command not found(...)?").unwrap(); let regex_zsh = Regex::new(r"zsh: command not found: ([^\s]+)").unwrap(); let regex_fish = Regex::new(r"fish: unknown command: ([^\s]+)").unwrap(); let regex_powershell = Regex::new(r"the term '([^']+)' is not recognized").unwrap(); diff --git a/tests/bash.rs b/tests/bash.rs index e13b575..ba0cf38 100644 --- a/tests/bash.rs +++ b/tests/bash.rs @@ -25,10 +25,10 @@ fn bash() { p.send_line("eval \"$(fixit init bash)\"").unwrap(); p.send_line("eco 'Hello, world!'").unwrap(); - // p.expect("command not found").unwrap(); + p.expect("command not found").unwrap(); p.send_line("fix").unwrap(); p.send_line("").unwrap(); - // p.expect("Hello, world!").unwrap(); + p.expect("Hello, world!").unwrap(); p.send_line("exit").unwrap(); let mut buf = String::new();