Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/uu/nice/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ path = "src/nice.rs"
test = false
doctest = false

[dependencies]
[target.'cfg(any(unix, windows))'.dependencies]
clap = { workspace = true }
fluent = { workspace = true }
uucore = { workspace = true }
Expand All @@ -33,3 +33,4 @@ workspace = true
[[bin]]
name = "nice"
path = "src/main.rs"
required-features = ["uucore/default"]
8 changes: 2 additions & 6 deletions src/uu/nice/src/nice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

// spell-checker:ignore (ToDO) getpriority setpriority nstr PRIO

#![cfg(any(unix, windows))]

use clap::{Arg, ArgAction, Command};
use std::ffi::OsString;
use std::io::{ErrorKind, Write, stdout};
Expand Down Expand Up @@ -125,7 +127,6 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
return Ok(());
};

#[cfg(any(unix, windows))]
let adjustment = match matches.get_one::<String>(options::ADJUSTMENT) {
None => 10,
Some(nstr) => match nstr.parse::<i32>() {
Expand All @@ -141,7 +142,6 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
},
};

#[cfg(any(unix, windows))]
let new_niceness = current_niceness.saturating_add(adjustment);
// We can't use `show_warning` because that will panic if stderr
// isn't writable. The GNU test suite checks specifically that the
Expand Down Expand Up @@ -177,10 +177,6 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let Err(err) = command.creation_flags(priority_class).spawn() else {
return Ok(());
};
#[cfg(not(any(unix, windows)))]
let Err(err) = command.status() else {
return Ok(());
};

show_error!("{}: {err}", cmd.quote());

Expand Down
Loading