make print flush (#5566)

This commit is contained in:
Darren Schroeder 2022-05-17 09:27:12 -05:00 committed by GitHub
parent 498672f5e5
commit f26d3bf8d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -37,7 +37,6 @@ impl Command for Print {
) -> Result<PipelineData, ShellError> {
let args: Vec<Value> = call.rest(engine_state, stack, 0)?;
let no_newline = call.has_flag("no_newline");
let head = call.head;
for arg in args {

View File

@ -437,6 +437,7 @@ impl PipelineData {
if let Some(stream) = stream {
for s in stream {
let _ = stdout.lock().write_all(s?.as_binary()?);
let _ = stdout.lock().flush()?;
}
}
@ -475,7 +476,9 @@ impl PipelineData {
}
match stdout.lock().write_all(out.as_bytes()) {
Ok(_) => (),
Ok(_) => {
let _ = stdout.lock().flush()?;
}
Err(err) => eprintln!("{}", err),
};
}
@ -498,7 +501,9 @@ impl PipelineData {
}
match stdout.lock().write_all(out.as_bytes()) {
Ok(_) => (),
Ok(_) => {
let _ = stdout.lock().flush()?;
}
Err(err) => eprintln!("{}", err),
};
}