File tree 2 files changed +11
-6
lines changed
2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -1635,12 +1635,8 @@ fn split(settings: &Settings) -> UResult<()> {
1635
1635
let r_box = if settings. input == "-" {
1636
1636
Box :: new ( stdin ( ) ) as Box < dyn Read >
1637
1637
} else {
1638
- let r = File :: open ( Path :: new ( & settings. input ) ) . map_err_context ( || {
1639
- format ! (
1640
- "cannot open {} for reading: No such file or directory" ,
1641
- settings. input. quote( )
1642
- )
1643
- } ) ?;
1638
+ let r = File :: open ( Path :: new ( & settings. input ) )
1639
+ . map_err_context ( || format ! ( "cannot open {} for reading" , settings. input. quote( ) ) ) ?;
1644
1640
Box :: new ( r) as Box < dyn Read >
1645
1641
} ;
1646
1642
let mut reader = if let Some ( c) = settings. io_blksize {
Original file line number Diff line number Diff line change @@ -123,6 +123,15 @@ fn test_invalid_arg() {
123
123
new_ucmd ! ( ) . arg ( "--definitely-invalid" ) . fails ( ) . code_is ( 1 ) ;
124
124
}
125
125
126
+ #[ test]
127
+ fn test_split_non_existing_file ( ) {
128
+ new_ucmd ! ( )
129
+ . arg ( "non-existing" )
130
+ . fails ( )
131
+ . code_is ( 1 )
132
+ . stderr_is ( "split: cannot open 'non-existing' for reading: No such file or directory\n " ) ;
133
+ }
134
+
126
135
#[ test]
127
136
fn test_split_default ( ) {
128
137
let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
You can’t perform that action at this time.
0 commit comments