fix: use deleteIfExists to work around potential race condition
This commit is contained in:
parent
a7a135c598
commit
8aa0555a2a
|
@ -116,7 +116,7 @@ public record Instance(String id, Path path, InstanceMeta meta, ModsDirScanner m
|
||||||
try {
|
try {
|
||||||
if (ProcessUtils.isProcessAlive(Files.readString(path.resolve(LOCK_NAME))))
|
if (ProcessUtils.isProcessAlive(Files.readString(path.resolve(LOCK_NAME))))
|
||||||
return true;
|
return true;
|
||||||
Files.delete(path.resolve(LOCK_NAME));
|
Files.deleteIfExists(path.resolve(LOCK_NAME));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Utils.LOGGER.error("Could not read running lock of " + getName(), e);
|
Utils.LOGGER.error("Could not read running lock of " + getName(), e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue