File tree 1 file changed +14
-0
lines changed 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -289,6 +289,19 @@ function should_retry_link_unlink(err) {
289
289
return should_retry_general || should_retry_gpfs || should_retry_posix ;
290
290
}
291
291
292
+ /**
293
+ * stat_ignore_enoent unlinks a file and if recieved an ENOENT error it'll not fail
294
+ * @param {nb.NativeFSContext } fs_context
295
+ * @param {string } file_path
296
+ * @returns {Promise<nb.NativeFSStats> }
297
+ */
298
+ async function stat_ignore_enoent ( fs_context , file_path ) {
299
+ try {
300
+ return await nb_native ( ) . fs . stat ( fs_context , file_path ) ;
301
+ } catch ( err ) {
302
+ if ( err . code !== 'ENOENT' ) throw err ;
303
+ }
304
+ }
292
305
293
306
/**
294
307
* stat_if_exists execute stat on entry_path and ignores on certain error codes.
@@ -729,6 +742,7 @@ exports.finally_close_files = finally_close_files;
729
742
exports . get_user_by_distinguished_name = get_user_by_distinguished_name ;
730
743
exports . get_config_files_tmpdir = get_config_files_tmpdir ;
731
744
exports . stat_if_exists = stat_if_exists ;
745
+ exports . stat_ignore_enoent = stat_ignore_enoent ;
732
746
733
747
exports . _is_gpfs = _is_gpfs ;
734
748
exports . safe_move = safe_move ;
You can’t perform that action at this time.
0 commit comments