File tree 2 files changed +14
-3
lines changed
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -371,7 +371,7 @@ async function chmod(path, mode) {
371
371
372
372
async function lchmod ( path , mode ) {
373
373
if ( O_SYMLINK === undefined )
374
- throw new ERR_METHOD_NOT_IMPLEMENTED ( ) ;
374
+ throw new ERR_METHOD_NOT_IMPLEMENTED ( 'lchmod()' ) ;
375
375
376
376
const fd = await open ( path , O_WRONLY | O_SYMLINK ) ;
377
377
return fchmod ( fd , mode ) . finally ( fd . close . bind ( fd ) ) ;
Original file line number Diff line number Diff line change @@ -140,15 +140,26 @@ function verifyStatObject(stat) {
140
140
( await realpath ( newLink ) ) . toLowerCase ( ) ) ;
141
141
assert . strictEqual ( newPath . toLowerCase ( ) ,
142
142
( await readlink ( newLink ) ) . toLowerCase ( ) ) ;
143
+
144
+ const newMode = 0o666 ;
143
145
if ( common . isOSX ) {
144
146
// lchmod is only available on macOS
145
- const newMode = 0o666 ;
146
147
await lchmod ( newLink , newMode ) ;
147
148
stats = await lstat ( newLink ) ;
148
149
assert . strictEqual ( stats . mode & 0o777 , newMode ) ;
150
+ } else {
151
+ await Promise . all ( [
152
+ assert . rejects (
153
+ lchmod ( newLink , newMode ) ,
154
+ common . expectsError ( {
155
+ code : 'ERR_METHOD_NOT_IMPLEMENTED' ,
156
+ type : Error ,
157
+ message : 'The lchmod() method is not implemented'
158
+ } )
159
+ )
160
+ ] ) ;
149
161
}
150
162
151
-
152
163
await unlink ( newLink ) ;
153
164
}
154
165
You can’t perform that action at this time.
0 commit comments