mirror of
https://github.com/nushell/nushell
synced 2025-01-16 15:14:26 +00:00
18 lines
411 B
Rust
18 lines
411 B
Rust
|
use nu_engine::EvaluationContext;
|
||
|
use nu_source::Text;
|
||
|
|
||
|
pub fn maybe_print_errors(context: &EvaluationContext, source: Text) -> bool {
|
||
|
let errors = context.current_errors.clone();
|
||
|
let mut errors = errors.lock();
|
||
|
|
||
|
if errors.len() > 0 {
|
||
|
let error = errors[0].clone();
|
||
|
*errors = vec![];
|
||
|
|
||
|
crate::script::print_err(error, &source);
|
||
|
true
|
||
|
} else {
|
||
|
false
|
||
|
}
|
||
|
}
|