forked from extern/nushell
6cf8df8685
* Move run_script to engine * Add which dep and feature to engine * Change unwrap to expect * Add wasm specification * Remove which from default, add specification correctly * Add nu-platform-specifics * Move is_external_cmd to platform_specifics * Add is_external_cmd to host and use it instead of nu_platform directly * Clean up if else logic in is_external_cmd * Bump nu-platform-specifics version * Pass context to print_err * Commit cargo.lock * Move print functions to own module inside nu-engine * Hypocratic change to run windows-nightly again * Add import for Ordering * Move printing of error to host * Move platform specific which functionality to basic host * Allow no use of cmd_name * Fix windows compile issue
19 lines
413 B
Rust
19 lines
413 B
Rust
use nu_source::Text;
|
|
|
|
use crate::EvaluationContext;
|
|
|
|
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![];
|
|
|
|
context.host.lock().print_err(error, &source);
|
|
true
|
|
} else {
|
|
false
|
|
}
|
|
}
|