File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed
packages/mongodb-memory-server-core/src/util Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -73,17 +73,27 @@ export class LockFile {
7373 return LockFileStatus . available ;
7474 }
7575
76- const readout = parseInt ( ( await fspromises . readFile ( file ) ) . toString ( ) . trim ( ) ) ;
76+ try {
77+ const readout = parseInt ( ( await fspromises . readFile ( file ) ) . toString ( ) . trim ( ) ) ;
7778
78- if ( readout === process . pid ) {
79- log ( 'checkLock: Lock File Already exists, and is for *this* process' ) ;
79+ if ( readout === process . pid ) {
80+ log ( 'checkLock: Lock File Already exists, and is for *this* process' ) ;
8081
81- return ! this . files . has ( file ) ? LockFileStatus . available : LockFileStatus . lockedSelf ;
82- }
82+ return ! this . files . has ( file ) ? LockFileStatus . available : LockFileStatus . lockedSelf ;
83+ }
84+
85+ log ( `checkLock: Lock File Aready exists, for an different process: "${ readout } "` ) ;
8386
84- log ( `checkLock: Lock File Aready exists, for an different process: "${ readout } "` ) ;
87+ return utils . isAlive ( readout ) ? LockFileStatus . lockedDifferent : LockFileStatus . available ;
88+ } catch ( err ) {
89+ if ( err . code === 'ENOENT' ) {
90+ log ( 'checkLock: reading file failed with ENOENT' ) ;
8591
86- return utils . isAlive ( readout ) ? LockFileStatus . lockedDifferent : LockFileStatus . available ;
92+ return LockFileStatus . available ;
93+ }
94+
95+ throw err ;
96+ }
8797 }
8898
8999 /**
You can’t perform that action at this time.
0 commit comments