File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -160,18 +160,12 @@ fn collect_matched_pids(settings: &Settings) -> Vec<ProcessInformation> {
160160 name. into ( )
161161 } ;
162162 let pattern_matched = {
163- let want = if settings. exact {
164- // Equals `Name` in /proc/<pid>/status
165- // The `unwrap` operation must succeed
166- // because the REGEX has been verified as correct in `uumain`.
167- & name
168- } else if settings. full {
163+ let want = if settings. full {
169164 // Equals `cmdline` in /proc/<pid>/cmdline
170165 & pid. cmdline
171166 } else {
172- // From manpage:
173- // The process name used for matching is limited to the 15 characters present in the output of /proc/pid/stat.
174- & pid. proc_stat ( ) [ ..15 ]
167+ // Equals `Name` in /proc/<pid>/status
168+ & name
175169 } ;
176170
177171 settings. regex . is_match ( want)
Original file line number Diff line number Diff line change @@ -369,6 +369,13 @@ fn test_invalid_signal() {
369369 . stderr_contains ( "Unknown signal 'foo'" ) ;
370370}
371371
372+ #[ test]
373+ #[ cfg( target_os = "linux" ) ]
374+ fn test_does_not_match_pid ( ) {
375+ let our_pid = std:: process:: id ( ) ;
376+ new_ucmd ! ( ) . arg ( our_pid. to_string ( ) ) . fails ( ) ;
377+ }
378+
372379#[ test]
373380#[ cfg( target_os = "linux" ) ]
374381fn test_too_long_pattern ( ) {
You can’t perform that action at this time.
0 commit comments