Skip to content

Commit

Permalink
Merge pull request #27 from cakebaker/renice_compilation_errors_on_wi…
Browse files Browse the repository at this point in the history
…ndows

renice: disable functionality not available on Windows
  • Loading branch information
sylvestre authored Apr 8, 2024
2 parents 353486d + a010a9a commit 0d43401
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/uu/renice/src/renice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.

use clap::{crate_version, Arg, Command};
#[cfg(not(windows))]
use libc::PRIO_PROCESS;
use std::env;
use std::io::Error;
use std::process;
use uucore::{error::UResult, format_usage, help_about, help_usage};

const ABOUT: &str = help_about!("renice.md");
const USAGE: &str = help_usage!("renice.md");
use clap::{crate_version, Arg, Command};

#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Expand All @@ -28,6 +30,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
process::exit(1);
});

// TODO: implement functionality on windows
#[cfg(not(windows))]
if unsafe { libc::setpriority(PRIO_PROCESS, pid.try_into().unwrap(), nice_value) } == -1 {
eprintln!("Failed to set nice value: {}", Error::last_os_error());
process::exit(1);
Expand Down

0 comments on commit 0d43401

Please sign in to comment.