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 {
|
||||
if (ProcessUtils.isProcessAlive(Files.readString(path.resolve(LOCK_NAME))))
|
||||
return true;
|
||||
Files.delete(path.resolve(LOCK_NAME));
|
||||
Files.deleteIfExists(path.resolve(LOCK_NAME));
|
||||
} catch (IOException e) {
|
||||
Utils.LOGGER.error("Could not read running lock of " + getName(), e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue