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 @@ -26,6 +26,24 @@ fn init() {
2626 eprintln ! ( "Setting UUTESTS_BINARY_PATH={TESTS_BINARY}" ) ;
2727}
2828
29+ #[ test]
30+ fn test_coreutils_help_ignore_args ( ) {
31+ use std:: process:: Command ;
32+
33+ let scenario = TestScenario :: new ( "help_ignoring_args" ) ;
34+ if !scenario. bin_path . exists ( ) {
35+ return ;
36+ }
37+
38+ let output = Command :: new ( & scenario. bin_path )
39+ . arg ( "--help" )
40+ . arg ( "---" )
41+ . output ( )
42+ . unwrap ( ) ;
43+
44+ assert_eq ! ( output. status. code( ) , Some ( 0 ) ) ;
45+ }
46+
2947#[ test]
3048#[ cfg( feature = "ls" ) ]
3149fn execution_phrase_double ( ) {
You can’t perform that action at this time.
0 commit comments