File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1148,6 +1148,19 @@ mod test {
1148
1148
check ! ( rmdir_recursive( dir) ) ;
1149
1149
}
1150
1150
1151
+ #[ test]
1152
+ fn mkdir_path_already_exists_error ( ) {
1153
+ use io:: { IoError , PathAlreadyExists } ;
1154
+
1155
+ let tmpdir = tmpdir ( ) ;
1156
+ let dir = & tmpdir. join ( "mkdir_error_twice" ) ;
1157
+ check ! ( mkdir( dir, io:: USER_RWX ) ) ;
1158
+ match mkdir ( dir, io:: USER_RWX ) {
1159
+ Err ( IoError { kind : PathAlreadyExists , ..} ) => ( ) ,
1160
+ _ => assert ! ( false )
1161
+ } ;
1162
+ }
1163
+
1151
1164
#[ test]
1152
1165
fn recursive_mkdir ( ) {
1153
1166
let tmpdir = tmpdir ( ) ;
Original file line number Diff line number Diff line change @@ -109,6 +109,8 @@ pub fn decode_error(errno: i32) -> IoError {
109
109
"file descriptor is not a TTY" ) ,
110
110
libc:: ETIMEDOUT => ( io:: TimedOut , "operation timed out" ) ,
111
111
libc:: ECANCELED => ( io:: TimedOut , "operation aborted" ) ,
112
+ libc:: consts:: os:: posix88:: EEXIST =>
113
+ ( io:: PathAlreadyExists , "path already exists" ) ,
112
114
113
115
// These two constants can have the same value on some systems,
114
116
// but different values on others, so we can't use a match
Original file line number Diff line number Diff line change @@ -121,6 +121,8 @@ pub fn decode_error(errno: i32) -> IoError {
121
121
"invalid handle provided to function" ) ,
122
122
libc:: ERROR_NOTHING_TO_TERMINATE =>
123
123
( io:: InvalidInput , "no process to kill" ) ,
124
+ libc:: ERROR_ALREADY_EXISTS =>
125
+ ( io:: PathAlreadyExists , "path already exists" ) ,
124
126
125
127
// libuv maps this error code to EISDIR. we do too. if it is found
126
128
// to be incorrect, we can add in some more machinery to only
You can’t perform that action at this time.
0 commit comments