File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -151,8 +151,20 @@ pub fn get_match_settings(matches: &ArgMatches) -> UResult<Settings> {
151151pub fn find_matching_pids ( settings : & Settings ) -> UResult < Vec < ProcessInformation > > {
152152 let mut pids = collect_matched_pids ( settings) ?;
153153
154+ let is_long_match = if settings. exact {
155+ settings
156+ . regex
157+ . as_str ( )
158+ . trim_matches ( '^' )
159+ . trim_matches ( '$' )
160+ . len ( )
161+ > 15
162+ } else {
163+ settings. regex . as_str ( ) . len ( ) > 15
164+ } ;
165+
154166 if pids. is_empty ( ) {
155- if !settings. full && settings . regex . as_str ( ) . len ( ) > 15 {
167+ if !settings. full && is_long_match {
156168 let msg = format ! ( "pattern that searches for process name longer than 15 characters will result in zero matches\n \
157169 Try `{} -f' option to match against the complete command line.", uucore:: util_name( ) ) ;
158170 return Err ( USimpleError :: new ( 1 , msg) ) ;
You can’t perform that action at this time.
0 commit comments