yoctui-utils 0.1.315

Shared utility functions for Yoctui
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use super::*;

#[test]
fn spawned_background_process_receives_requested_priority() {
    let mut child = std::process::Command::new("sleep")
        .arg("30")
        .spawn()
        .unwrap();
    lower_process_priority(child.id(), 10).unwrap();
    // SAFETY: getpriority reads kernel state for the live child PID.
    let nice = unsafe { libc::getpriority(libc::PRIO_PROCESS, child.id()) };
    let _ = child.kill();
    let _ = child.wait();
    assert_eq!(nice, 10);
}