From 515c218f0c4a1e4495a4ef7d65ac932d14b31b0c Mon Sep 17 00:00:00 2001 From: "Vassiliy.Kudryashov" Date: Thu, 10 Nov 2022 20:15:43 +0300 Subject: [PATCH] Generation shouldn't fail if there is old (not actually locked) utbot.lock file --- .../main/kotlin/org/utbot/framework/plugin/api/util/LockFile.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util/LockFile.kt b/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util/LockFile.kt index e9ac6a3aa1..3f5fc0a9e4 100644 --- a/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util/LockFile.kt +++ b/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util/LockFile.kt @@ -22,7 +22,7 @@ object LockFile { if (currentLock != null) return false return try { Paths.get(utbotHomePath).toFile().mkdirs() - currentLock = Paths.get(lockFilePath).outputStream(StandardOpenOption.CREATE_NEW, StandardOpenOption.DELETE_ON_CLOSE).also { + currentLock = Paths.get(lockFilePath).outputStream(StandardOpenOption.CREATE, StandardOpenOption.DELETE_ON_CLOSE).also { it.write(DateFormat.getDateTimeInstance().format(System.currentTimeMillis()).toByteArray()) } logger.debug("Locked")