writing to stdout

This commit is contained in:
Fernando Herrera 2021-09-25 15:56:33 +01:00
parent cf60f72452
commit b12a265f1e

View file

@ -1,3 +1,5 @@
use std::io::Write;
use miette::{IntoDiagnostic, Result};
use nu_cli::{report_error, NuCompleter, NuHighlighter, NuValidator};
use nu_command::create_default_context;
@ -139,7 +141,12 @@ fn main() -> Result<()> {
}
None => value.into_string(),
};
println!("{}", output);
let stdout = std::io::stdout();
match stdout.lock().write_all(output.as_bytes()) {
Ok(_) => (),
Err(err) => eprintln!("{}", err),
};
}
Err(err) => {
let engine_state = engine_state.borrow();