(lockPath)
| 257 | } |
| 258 | |
| 259 | function readBinaryLockOwner(lockPath) { |
| 260 | try { |
| 261 | const owner = JSON.parse( |
| 262 | fs.readFileSync(path.join(lockPath, 'owner.json'), 'utf8'), |
| 263 | ); |
| 264 | if (!Number.isSafeInteger(owner.pid) || owner.pid <= 0 || |
| 265 | typeof owner.token !== 'string' || !/^[0-9a-f]{32}$/.test(owner.token)) { |
| 266 | return null; |
| 267 | } |
| 268 | return owner; |
| 269 | } catch (_) { |
| 270 | return null; |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | function tryReclaimBinaryLock(lockPath, contenderToken) { |
| 275 | let reclaim = false; |
no outgoing calls
no test coverage detected