Don't swallow IOException in GC.PidLock#lock

This broke the test GcConcurrentTest#testInterruptGc which expects
ClosedByInterruptException when the thread doing gc is interrupted.

Change-Id: I89e02fc37aceeccb04c20cfc5b71cb8fa21793d6
This commit is contained in:
Matthias Sohn 2023-02-22 19:27:30 +01:00
parent a6da439b47
commit 49f5273867
1 changed files with 2 additions and 2 deletions

View File

@ -1631,7 +1631,7 @@ private class PidLock implements AutoCloseable {
pidFile = repo.getDirectory().toPath().resolve(GC_PID); pidFile = repo.getDirectory().toPath().resolve(GC_PID);
} }
boolean lock() { boolean lock() throws IOException {
if (Files.exists(pidFile)) { if (Files.exists(pidFile)) {
Instant mtime = FS.DETECTED Instant mtime = FS.DETECTED
.lastModifiedInstant(pidFile.toFile()); .lastModifiedInstant(pidFile.toFile());
@ -1670,7 +1670,7 @@ boolean lock() {
JGitText.get().closePidLockFailed, pidFile), JGitText.get().closePidLockFailed, pidFile),
e1); e1);
} }
return false; throw e;
} }
return true; return true;
} }