Don't show errors on prepare cancel action (PY-63083)

+ correct exception handling (remove double wrap)
+ treat cancellation of sudo password request as cancel, not as ExitNonZero

GitOrigin-RevId: baf43c9bb4652b0552899252b5638371715ee7a0
This commit is contained in:
Vitaly Legchilkin
2023-11-28 17:21:49 +01:00
committed by intellij-monorepo-bot
parent 8abfa7d8d4
commit 6f69eaeb7a
3 changed files with 13 additions and 3 deletions

View File

@@ -128,6 +128,9 @@ abstract class DownloadableReleaseInstaller : ReleaseInstaller {
catch (e: ProcessCanceledException) {
throw CancelledPrepareException(e)
}
catch (e: PrepareException) {
throw e
}
catch (e: Exception) {
throw PrepareException(e)
}

View File

@@ -30,7 +30,7 @@ class PkgReleaseInstaller : ResourceTypeReleaseInstaller(ResourceType.APPLE_SOFT
*/
class ExeReleaseInstaller : ResourceTypeReleaseInstaller(ResourceType.MICROSOFT_WINDOWS_EXECUTABLE) {
override fun buildCommandLine(resource: Resource, path: Path): GeneralCommandLine {
return GeneralCommandLine(path.absolutePathString(), "/quiet")
return GeneralCommandLine(path.absolutePathString(), "/quiet", "InstallAllUsers=0")
}
}
@@ -62,7 +62,12 @@ abstract class ResourceTypeReleaseInstaller(private val resourceType: ResourceTy
throw ExecutionProcessException(commandLine, e)
}
processOutput.isCancelled.takeIf { it }?.let { throw CancelledProcessException(commandLine, processOutput) }
processOutput.exitCode.takeIf { it != 0 }?.let { throw NonZeroExitCodeProcessException(commandLine, processOutput) }
processOutput.exitCode.takeIf { it != 0 }?.let {
if (processOutput.stderr.contains("User cancelled", ignoreCase = true)) {
throw CancelledProcessException(commandLine, processOutput)
}
throw NonZeroExitCodeProcessException(commandLine, processOutput)
}
processOutput.isTimeout.takeIf { it }?.let { throw TimeoutProcessException(commandLine, processOutput) }
}

View File

@@ -60,7 +60,9 @@ object PySdkToInstallManager {
catch (ex: ReleaseInstallerException) {
LOGGER.info(ex)
PySdkToInstallCollector.logInstallerException(project, sdk.release, ex)
showErrorNotification(sdk.release, ex)
if (ex !is PrepareException) {
showErrorNotification(sdk.release, ex)
}
}
return null
}