Skip to content

Commit

Permalink
pkill: beautify code
Browse files Browse the repository at this point in the history
  • Loading branch information
MCredbear committed Jan 1, 2025
1 parent dd39789 commit 21e10e4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/uu/pkill/src/pkill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
use clap::{arg, crate_version, Arg, ArgAction, ArgGroup, ArgMatches, Command};
use nix::sys::signal::{self, Signal};
use nix::unistd::Pid;
use uu_pgrep::process::{walk_process, ProcessInformation, Teletype};
use regex::Regex;
use std::io::Error;
use std::{collections::HashSet, sync::OnceLock};
use uu_pgrep::process::{walk_process, ProcessInformation, Teletype};
use uucore::display::Quotable;
use uucore::error::FromIo;
use uucore::show;
Expand Down Expand Up @@ -107,7 +107,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let mut pids = collect_matched_pids(&settings);
if matches.get_flag("require-handler") {
pids.retain(|pid| {
let mask = u32::from_str_radix(pid.clone().status().get("SigCgt").unwrap(), 16).unwrap();
let mask =
u32::from_str_radix(pid.clone().status().get("SigCgt").unwrap(), 16).unwrap();
mask & (1 << sig_num) != 0
});
}
Expand Down
2 changes: 1 addition & 1 deletion tests/by-util/test_pkill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ fn test_invalid_arg() {
#[test]
fn test_help() {
new_ucmd!().arg("--help").succeeds();
}
}
2 changes: 1 addition & 1 deletion tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ mod test_snice;

#[cfg(feature = "pkill")]
#[path = "by-util/test_pkill.rs"]
mod test_pkill;
mod test_pkill;

0 comments on commit 21e10e4

Please sign in to comment.