File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -125,26 +125,8 @@ fn main() {
125125 process:: exit ( uumain ( vec ! [ util_os] . into_iter ( ) . chain ( args) ) ) ;
126126 }
127127 None => {
128+ // GNU coreutils --help string shows help for coreutils
128129 if util == "--help" || util == "-h" {
129- // see if they want help on a specific util
130- if let Some ( util_os) = args. next ( ) {
131- let Some ( util) = util_os. to_str ( ) else {
132- validation:: not_found ( & util_os)
133- } ;
134-
135- match utils. get ( util) {
136- Some ( & ( uumain, _) ) => {
137- let code = uumain (
138- vec ! [ util_os, OsString :: from( "--help" ) ]
139- . into_iter ( )
140- . chain ( args) ,
141- ) ;
142- io:: stdout ( ) . flush ( ) . expect ( "could not flush stdout" ) ;
143- process:: exit ( code) ;
144- }
145- None => validation:: not_found ( & util_os) ,
146- }
147- }
148130 usage ( & utils, binary_as_util) ;
149131 process:: exit ( 0 ) ;
150132 } else if util. starts_with ( '-' ) {
Original file line number Diff line number Diff line change @@ -40,6 +40,18 @@ fn binary_name_protection() {
4040 . stdout_contains ( "coreutils" ) ;
4141}
4242
43+ #[ test]
44+ fn test_coreutils_help_ignore_args ( ) {
45+ let scenario = TestScenario :: new ( "help_ignoring_args" ) ;
46+ let output = std:: process:: Command :: new ( & scenario. bin_path )
47+ . arg ( "--help" )
48+ . arg ( "---" )
49+ . output ( )
50+ . unwrap ( ) ;
51+
52+ assert_eq ! ( output. status. code( ) , Some ( 0 ) ) ;
53+ }
54+
4355#[ test]
4456#[ cfg( feature = "ls" ) ]
4557fn execution_phrase_double ( ) {
You can’t perform that action at this time.
0 commit comments