Found while fixing the EBUSY reopen on CI.
acquireLock() writes .tern/lock with the owning pid, but nothing checks that pid on the next start. If tern is killed between open() and close(), every later tern sync fails with EEXIST until the file is deleted by hand.
Repro
tern sync against a slow remotekill -9 it while uploadingtern sync again → EEXIST: .tern/lock
Suggested fix: read the pid from the lock; if that process is gone, take the lock over.