We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8f2c3c5 + 67cedcd commit 8041772Copy full SHA for 8041772
src/uu/nproc/src/nproc.rs
@@ -6,6 +6,7 @@
6
// spell-checker:ignore (ToDO) NPROCESSORS nprocs numstr sysconf
7
8
use clap::{Arg, ArgAction, Command};
9
+use std::io::{Write, stdout};
10
use std::{env, thread};
11
use uucore::display::Quotable;
12
use uucore::error::{UResult, USimpleError};
@@ -85,7 +86,11 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
85
86
} else {
87
cores -= ignore;
88
}
- println!("{cores}");
89
+ //discard error about stdout flush
90
+ stdout()
91
+ .lock()
92
+ .write_all(format!("{cores}\n").as_bytes())
93
+ .map_err(|e| USimpleError::new(1, e.to_string()))?;
94
Ok(())
95
96
0 commit comments