File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed
Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -81,10 +81,9 @@ export class EnableCommand extends Command<Context> {
8181 async generatePosixLink ( installDirectory : string , distFolder : string , binName : string ) {
8282 const file = path . join ( installDirectory , binName ) ;
8383 const symlink = path . relative ( installDirectory , path . join ( distFolder , `${ binName } .js` ) ) ;
84+ const stats = fs . lstatSync ( file , { throwIfNoEntry : false } ) ;
8485
85- if ( fs . existsSync ( file ) ) {
86- const stats = await fs . promises . lstat ( file ) ;
87-
86+ if ( stats ) {
8887 if ( stats . isSymbolicLink ( ) ) {
8988 const currentSymlink = await fs . promises . readlink ( file ) ;
9089
@@ -93,14 +92,9 @@ export class EnableCommand extends Command<Context> {
9392 return ;
9493 }
9594
96- if ( currentSymlink !== symlink ) {
97- await fs . promises . unlink ( file ) ;
98- } else {
99- return ;
100- }
101- } else {
102- await fs . promises . unlink ( file ) ;
95+ if ( currentSymlink === symlink ) return ;
10396 }
97+ await fs . promises . unlink ( file ) ;
10498 }
10599
106100 await fs . promises . symlink ( symlink , file ) ;
You can’t perform that action at this time.
0 commit comments