From b12a265f1ee1ef3b127b36c39b8f227388de368f Mon Sep 17 00:00:00 2001 From: Fernando Herrera Date: Sat, 25 Sep 2021 15:56:33 +0100 Subject: [PATCH] writing to stdout --- src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 1586a21a68..84976b179a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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();