(lockPath)
| 395 | } |
| 396 | |
| 397 | function readBinaryLockOwner(lockPath) { |
| 398 | try { |
| 399 | const owner = JSON.parse( |
| 400 | fs.readFileSync(path.join(lockPath, 'owner.json'), 'utf8'), |
| 401 | ); |
| 402 | if (!Number.isSafeInteger(owner.pid) || owner.pid <= 0 || |
| 403 | typeof owner.token !== 'string' || !/^[0-9a-f]{32}$/.test(owner.token)) { |
| 404 | return null; |
| 405 | } |
| 406 | return owner; |
| 407 | } catch (_) { |
| 408 | return null; |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | function tryReclaimBinaryLock(lockPath, contenderToken) { |
| 413 | let reclaim = false; |
no outgoing calls
no test coverage detected