(lockPath: string = DEFAULT_LOCK_PATH)
| 152 | * is no daemon to reuse. Read-only: never mutates the lock. |
| 153 | */ |
| 154 | export function getLiveLock(lockPath: string = DEFAULT_LOCK_PATH): LockContents | undefined { |
| 155 | const contents = readLockContents(lockPath); |
| 156 | if (!contents) return undefined; |
| 157 | return pidAlive(contents.pid) ? contents : undefined; |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | * Try `O_WRONLY | O_CREAT | O_EXCL` to create the lock file with the contents. |
no test coverage detected