@@ -7,10 +7,10 @@ const {
7
7
MathMin,
8
8
NumberIsSafeInteger,
9
9
Promise,
10
- PromisePrototypeFinally,
11
10
PromisePrototypeThen,
12
11
PromiseResolve,
13
12
SafeArrayIterator,
13
+ SafePromisePrototypeFinally,
14
14
Symbol,
15
15
Uint8Array,
16
16
} = primordials ;
@@ -186,12 +186,12 @@ class FileHandle extends EventEmitterMixin(JSTransferable) {
186
186
this [ kRefs ] -- ;
187
187
if ( this [ kRefs ] === 0 ) {
188
188
this [ kFd ] = - 1 ;
189
- this [ kClosePromise ] = PromisePrototypeFinally (
189
+ this [ kClosePromise ] = SafePromisePrototypeFinally (
190
190
this [ kHandle ] . close ( ) ,
191
191
( ) => { this [ kClosePromise ] = undefined ; }
192
192
) ;
193
193
} else {
194
- this [ kClosePromise ] = PromisePrototypeFinally (
194
+ this [ kClosePromise ] = SafePromisePrototypeFinally (
195
195
new Promise ( ( resolve , reject ) => {
196
196
this [ kCloseResolve ] = resolve ;
197
197
this [ kCloseReject ] = reject ;
@@ -507,7 +507,7 @@ async function rename(oldPath, newPath) {
507
507
508
508
async function truncate ( path , len = 0 ) {
509
509
const fd = await open ( path , 'r+' ) ;
510
- return PromisePrototypeFinally ( ftruncate ( fd , len ) , fd . close ) ;
510
+ return SafePromisePrototypeFinally ( ftruncate ( fd , len ) , fd . close ) ;
511
511
}
512
512
513
513
async function ftruncate ( handle , len = 0 ) {
@@ -638,7 +638,7 @@ async function lchmod(path, mode) {
638
638
throw new ERR_METHOD_NOT_IMPLEMENTED ( 'lchmod()' ) ;
639
639
640
640
const fd = await open ( path , O_WRONLY | O_SYMLINK ) ;
641
- return PromisePrototypeFinally ( fchmod ( fd , mode ) , fd . close ) ;
641
+ return SafePromisePrototypeFinally ( fchmod ( fd , mode ) , fd . close ) ;
642
642
}
643
643
644
644
async function lchown ( path , uid , gid ) {
@@ -717,7 +717,7 @@ async function writeFile(path, data, options) {
717
717
checkAborted ( options . signal ) ;
718
718
719
719
const fd = await open ( path , flag , options . mode ) ;
720
- return PromisePrototypeFinally (
720
+ return SafePromisePrototypeFinally (
721
721
writeFileHandle ( fd , data , options . signal , options . encoding ) , fd . close ) ;
722
722
}
723
723
@@ -742,7 +742,7 @@ async function readFile(path, options) {
742
742
checkAborted ( options . signal ) ;
743
743
744
744
const fd = await open ( path , flag , 0o666 ) ;
745
- return PromisePrototypeFinally ( readFileHandle ( fd , options ) , fd . close ) ;
745
+ return SafePromisePrototypeFinally ( readFileHandle ( fd , options ) , fd . close ) ;
746
746
}
747
747
748
748
module . exports = {
0 commit comments