mirror of
https://github.com/nushell/nushell
synced 2024-11-15 01:17:07 +00:00
Dont unwrap rustyline helper in cli (#3382)
If nu fails to load a user config on startup, no helper is set and the later call to `rl.helper_mut()` will panic. There may be better ways to handle this long-term, but printing an error about the failure to parse the config and then starting with default values seems reasonable.
This commit is contained in:
parent
fc59291191
commit
cfee151d4e
1 changed files with 3 additions and 1 deletions
|
@ -301,7 +301,9 @@ pub fn cli(context: EvaluationContext, options: Options) -> Result<(), Box<dyn E
|
|||
}
|
||||
};
|
||||
|
||||
rl.helper_mut().expect("No helper").colored_prompt = colored_prompt;
|
||||
if let Some(helper) = rl.helper_mut() {
|
||||
helper.colored_prompt = colored_prompt;
|
||||
}
|
||||
let mut initial_command = Some(String::new());
|
||||
let mut readline = Err(ReadlineError::Eof);
|
||||
while let Some(ref cmd) = initial_command {
|
||||
|
|
Loading…
Reference in a new issue