@@ -15,6 +15,7 @@ const {
15
15
MathMin,
16
16
NumberIsSafeInteger,
17
17
Promise,
18
+ PromisePrototypeFinally,
18
19
PromiseResolve,
19
20
Symbol,
20
21
Uint8Array,
@@ -410,7 +411,7 @@ async function rename(oldPath, newPath) {
410
411
411
412
async function truncate ( path , len = 0 ) {
412
413
const fd = await open ( path , 'r+' ) ;
413
- return ftruncate ( fd , len ) . finally ( fd . close ) ;
414
+ return PromisePrototypeFinally ( ftruncate ( fd , len ) , fd . close ) ;
414
415
}
415
416
416
417
async function ftruncate ( handle , len = 0 ) {
@@ -538,7 +539,7 @@ async function lchmod(path, mode) {
538
539
throw new ERR_METHOD_NOT_IMPLEMENTED ( 'lchmod()' ) ;
539
540
540
541
const fd = await open ( path , O_WRONLY | O_SYMLINK ) ;
541
- return fchmod ( fd , mode ) . finally ( fd . close ) ;
542
+ return PromisePrototypeFinally ( fchmod ( fd , mode ) , fd . close ) ;
542
543
}
543
544
544
545
async function lchown ( path , uid , gid ) {
@@ -614,7 +615,7 @@ async function writeFile(path, data, options) {
614
615
return writeFileHandle ( path , data ) ;
615
616
616
617
const fd = await open ( path , flag , options . mode ) ;
617
- return writeFileHandle ( fd , data ) . finally ( fd . close ) ;
618
+ return PromisePrototypeFinally ( writeFileHandle ( fd , data ) , fd . close ) ;
618
619
}
619
620
620
621
async function appendFile ( path , data , options ) {
@@ -632,7 +633,7 @@ async function readFile(path, options) {
632
633
return readFileHandle ( path , options ) ;
633
634
634
635
const fd = await open ( path , flag , 0o666 ) ;
635
- return readFileHandle ( fd , options ) . finally ( fd . close ) ;
636
+ return PromisePrototypeFinally ( readFileHandle ( fd , options ) , fd . close ) ;
636
637
}
637
638
638
639
module . exports = {
0 commit comments