Install GraalVM components before move (#1660)

Install the required GraalVM components before 
moving the directory.
This commit is contained in:
Dmitry Bushev 2021-04-09 12:09:54 +03:00 committed by GitHub
parent 9f60e22508
commit 0aa5b5647e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -697,13 +697,18 @@ class RuntimeVersionManager(
}
try {
val temporaryRuntime = loadGraalRuntime(runtimeTemporaryPath)
if (temporaryRuntime.isFailure) {
val temporaryRuntime =
loadGraalRuntime(runtimeTemporaryPath).getOrElse {
throw InstallationError(
"Cannot load the installed runtime. The package may have been " +
"corrupted. Reverting installation."
)
}
installRequiredRuntimeComponents(temporaryRuntime, os).getOrElse {
throw InstallationError(
"fatal: Cannot install the required runtime components."
)
}
val runtimePath =
distributionManager.paths.runtimes / runtimeDirectoryName
@ -714,13 +719,6 @@ class RuntimeVersionManager(
"fatal: Cannot load the installed runtime."
)
}
installRequiredRuntimeComponents(runtime, os).getOrElse {
FileSystem.removeDirectory(runtimePath)
throw InstallationError(
"fatal: Cannot install the required runtime components."
)
}
userInterface.logInfo(s"Installed $runtime.")
runtime