mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-300773 process cannot access the file because it is being used by another process on Windows
GitOrigin-RevId: ae6cf50053413b445bf2ec6c875e6b9496e57dca
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3575a0302b
commit
383fe78c62
@@ -41,6 +41,7 @@ suspend fun runJava(mainClass: String,
|
||||
.useWithScope2 { span ->
|
||||
withContext(Dispatchers.IO) {
|
||||
val toDelete = ArrayList<Path>(3)
|
||||
var process: Process? = null
|
||||
try {
|
||||
val classpathFile = Files.createTempFile("classpath-", ".txt").also(toDelete::add)
|
||||
val classPathStringBuilder = createClassPathFile(classPath, classpathFile)
|
||||
@@ -53,7 +54,7 @@ suspend fun runJava(mainClass: String,
|
||||
val errorOutputFile = Files.createTempFile("error-out-", ".txt").also(toDelete::add)
|
||||
val outputFile = customOutputFile?.also { customOutputFile.parent?.let { Files.createDirectories(it) } }
|
||||
?: Files.createTempFile("out-", ".txt").also(toDelete::add)
|
||||
val process = ProcessBuilder(processArgs)
|
||||
process = ProcessBuilder(processArgs)
|
||||
.directory(workingDir?.toFile())
|
||||
.redirectError(errorOutputFile.toFile())
|
||||
.redirectOutput(outputFile.toFile())
|
||||
@@ -99,6 +100,7 @@ suspend fun runJava(mainClass: String,
|
||||
}
|
||||
}
|
||||
finally {
|
||||
process?.waitFor()
|
||||
toDelete.forEach(FileUtilRt::deleteRecursively)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user