@@ -108,7 +108,9 @@ function test_simple_relative_symlink(realpath, realpathSync, callback) {
108
108
[
109
109
[ entry , `../${ path . basename ( tmpDir ) } /cycles/root.js` ] ,
110
110
] . forEach ( function ( t ) {
111
- try { fs . unlinkSync ( t [ 0 ] ) ; } catch { }
111
+ try { fs . unlinkSync ( t [ 0 ] ) ; } catch {
112
+ // Continue regardless of error.
113
+ }
112
114
console . log ( 'fs.symlinkSync(%j, %j, %j)' , t [ 1 ] , t [ 0 ] , 'file' ) ;
113
115
fs . symlinkSync ( t [ 1 ] , t [ 0 ] , 'file' ) ;
114
116
unlink . push ( t [ 0 ] ) ;
@@ -134,7 +136,9 @@ function test_simple_absolute_symlink(realpath, realpathSync, callback) {
134
136
[
135
137
[ entry , expected ] ,
136
138
] . forEach ( function ( t ) {
137
- try { fs . unlinkSync ( t [ 0 ] ) ; } catch { }
139
+ try { fs . unlinkSync ( t [ 0 ] ) ; } catch {
140
+ // Continue regardless of error.
141
+ }
138
142
console . error ( 'fs.symlinkSync(%j, %j, %j)' , t [ 1 ] , t [ 0 ] , type ) ;
139
143
fs . symlinkSync ( t [ 1 ] , t [ 0 ] , type ) ;
140
144
unlink . push ( t [ 0 ] ) ;
@@ -159,13 +163,17 @@ function test_deep_relative_file_symlink(realpath, realpathSync, callback) {
159
163
expected ) ;
160
164
const linkPath1 = path . join ( targetsAbsDir ,
161
165
'nested-index' , 'one' , 'symlink1.js' ) ;
162
- try { fs . unlinkSync ( linkPath1 ) ; } catch { }
166
+ try { fs . unlinkSync ( linkPath1 ) ; } catch {
167
+ // Continue regardless of error.
168
+ }
163
169
fs . symlinkSync ( linkData1 , linkPath1 , 'file' ) ;
164
170
165
171
const linkData2 = '../one/symlink1.js' ;
166
172
const entry = path . join ( targetsAbsDir ,
167
173
'nested-index' , 'two' , 'symlink1-b.js' ) ;
168
- try { fs . unlinkSync ( entry ) ; } catch { }
174
+ try { fs . unlinkSync ( entry ) ; } catch {
175
+ // Continue regardless of error.
176
+ }
169
177
fs . symlinkSync ( linkData2 , entry , 'file' ) ;
170
178
unlink . push ( linkPath1 ) ;
171
179
unlink . push ( entry ) ;
@@ -186,13 +194,17 @@ function test_deep_relative_dir_symlink(realpath, realpathSync, callback) {
186
194
const path1b = path . join ( targetsAbsDir , 'nested-index' , 'one' ) ;
187
195
const linkPath1b = path . join ( path1b , 'symlink1-dir' ) ;
188
196
const linkData1b = path . relative ( path1b , expected ) ;
189
- try { fs . unlinkSync ( linkPath1b ) ; } catch { }
197
+ try { fs . unlinkSync ( linkPath1b ) ; } catch {
198
+ // Continue regardless of error.
199
+ }
190
200
fs . symlinkSync ( linkData1b , linkPath1b , 'dir' ) ;
191
201
192
202
const linkData2b = '../one/symlink1-dir' ;
193
203
const entry = path . join ( targetsAbsDir ,
194
204
'nested-index' , 'two' , 'symlink12-dir' ) ;
195
- try { fs . unlinkSync ( entry ) ; } catch { }
205
+ try { fs . unlinkSync ( entry ) ; } catch {
206
+ // Continue regardless of error.
207
+ }
196
208
fs . symlinkSync ( linkData2b , entry , 'dir' ) ;
197
209
unlink . push ( linkPath1b ) ;
198
210
unlink . push ( entry ) ;
@@ -216,7 +228,9 @@ function test_cyclic_link_protection(realpath, realpathSync, callback) {
216
228
[ path . join ( tmpDir , '/cycles/realpath-3b' ) , '../cycles/realpath-3c' ] ,
217
229
[ path . join ( tmpDir , '/cycles/realpath-3c' ) , '../cycles/realpath-3a' ] ,
218
230
] . forEach ( function ( t ) {
219
- try { fs . unlinkSync ( t [ 0 ] ) ; } catch { }
231
+ try { fs . unlinkSync ( t [ 0 ] ) ; } catch {
232
+ // Continue regardless of error.
233
+ }
220
234
fs . symlinkSync ( t [ 1 ] , t [ 0 ] , 'dir' ) ;
221
235
unlink . push ( t [ 0 ] ) ;
222
236
} ) ;
@@ -243,7 +257,9 @@ function test_cyclic_link_overprotection(realpath, realpathSync, callback) {
243
257
const link = `${ folder } /cycles` ;
244
258
let testPath = cycles ;
245
259
testPath += '/folder/cycles' . repeat ( 10 ) ;
246
- try { fs . unlinkSync ( link ) ; } catch { }
260
+ try { fs . unlinkSync ( link ) ; } catch {
261
+ // Continue regardless of error.
262
+ }
247
263
fs . symlinkSync ( cycles , link , 'dir' ) ;
248
264
unlink . push ( link ) ;
249
265
assertEqualPath ( realpathSync ( testPath ) , path . resolve ( expected ) ) ;
@@ -271,7 +287,9 @@ function test_relative_input_cwd(realpath, realpathSync, callback) {
271
287
] . forEach ( function ( t ) {
272
288
const fn = t [ 0 ] ;
273
289
console . error ( 'fn=%j' , fn ) ;
274
- try { fs . unlinkSync ( fn ) ; } catch { }
290
+ try { fs . unlinkSync ( fn ) ; } catch {
291
+ // Continue regardless of error.
292
+ }
275
293
const b = path . basename ( t [ 1 ] ) ;
276
294
const type = ( b === 'root.js' ? 'file' : 'dir' ) ;
277
295
console . log ( 'fs.symlinkSync(%j, %j, %j)' , t [ 1 ] , fn , type ) ;
@@ -309,8 +327,12 @@ function test_deep_symlink_mix(realpath, realpathSync, callback) {
309
327
// $tmpDir/targets/cycles/root.js (hard)
310
328
311
329
const entry = tmp ( 'node-test-realpath-f1' ) ;
312
- try { fs . unlinkSync ( tmp ( 'node-test-realpath-d2/foo' ) ) ; } catch { }
313
- try { fs . rmdirSync ( tmp ( 'node-test-realpath-d2' ) ) ; } catch { }
330
+ try { fs . unlinkSync ( tmp ( 'node-test-realpath-d2/foo' ) ) ; } catch {
331
+ // Continue regardless of error.
332
+ }
333
+ try { fs . rmdirSync ( tmp ( 'node-test-realpath-d2' ) ) ; } catch {
334
+ // Continue regardless of error.
335
+ }
314
336
fs . mkdirSync ( tmp ( 'node-test-realpath-d2' ) , 0o700 ) ;
315
337
try {
316
338
[
@@ -325,7 +347,9 @@ function test_deep_symlink_mix(realpath, realpathSync, callback) {
325
347
[ `${ targetsAbsDir } /nested-index/two/realpath-c` ,
326
348
`${ tmpDir } /cycles/root.js` ] ,
327
349
] . forEach ( function ( t ) {
328
- try { fs . unlinkSync ( t [ 0 ] ) ; } catch { }
350
+ try { fs . unlinkSync ( t [ 0 ] ) ; } catch {
351
+ // Continue regardless of error.
352
+ }
329
353
fs . symlinkSync ( t [ 1 ] , t [ 0 ] ) ;
330
354
unlink . push ( t [ 0 ] ) ;
331
355
} ) ;
@@ -479,14 +503,18 @@ function test_abs_with_kids(realpath, realpathSync, cb) {
479
503
[ '/a/b/c/x.txt' ,
480
504
'/a/link' ,
481
505
] . forEach ( function ( file ) {
482
- try { fs . unlinkSync ( root + file ) ; } catch { }
506
+ try { fs . unlinkSync ( root + file ) ; } catch {
507
+ // Continue regardless of error.
508
+ }
483
509
} ) ;
484
510
[ '/a/b/c' ,
485
511
'/a/b' ,
486
512
'/a' ,
487
513
'' ,
488
514
] . forEach ( function ( folder ) {
489
- try { fs . rmdirSync ( root + folder ) ; } catch { }
515
+ try { fs . rmdirSync ( root + folder ) ; } catch {
516
+ // Continue regardless of error.
517
+ }
490
518
} ) ;
491
519
}
492
520
0 commit comments