File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -371,8 +371,27 @@ export class App {
371
371
372
372
if ( this . opts . tmpdir !== false ) {
373
373
debug ( `Moving ${ this . stagingPath } to ${ finalPath } ` ) ;
374
- await fs . promises . mkdir ( finalPath , { recursive : true } ) ;
375
- await promisifiedGracefulFs . rename ( this . stagingPath , finalPath ) ;
374
+ try {
375
+ await fs . promises . mkdir ( path . resolve ( finalPath , '..' ) , {
376
+ recursive : true ,
377
+ } ) ;
378
+ await fs . promises . rename ( this . stagingPath , finalPath ) ;
379
+ } catch ( err ) {
380
+ if ( ( err as NodeJS . ErrnoException ) . code === 'EXDEV' ) {
381
+ // Cross-device link, fallback to copy and delete
382
+ await fs . promises . cp ( this . stagingPath , finalPath , {
383
+ force : true ,
384
+ recursive : true ,
385
+ verbatimSymlinks : true ,
386
+ } ) ;
387
+ await fs . promises . rm ( this . stagingPath , {
388
+ force : true ,
389
+ recursive : true ,
390
+ } ) ;
391
+ } else {
392
+ throw err ;
393
+ }
394
+ }
376
395
}
377
396
378
397
if ( this . opts . afterComplete ) {
You can’t perform that action at this time.
0 commit comments