From 62894e202a3cb50cbe3f9ec38abdade4ff01ddd3 Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Tue, 14 Nov 2017 15:01:00 +0100 Subject: [PATCH] Log a warning if couldn't read shell environment --- .../python/run/PyVirtualEnvReader.kt | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/python/src/com/jetbrains/python/run/PyVirtualEnvReader.kt b/python/src/com/jetbrains/python/run/PyVirtualEnvReader.kt index 29402cbca2b0..9a4be523d65e 100644 --- a/python/src/com/jetbrains/python/run/PyVirtualEnvReader.kt +++ b/python/src/com/jetbrains/python/run/PyVirtualEnvReader.kt @@ -53,18 +53,23 @@ class PyVirtualEnvReader(val virtualEnvSdkPath: String) : EnvironmentUtil.ShellE } override fun readShellEnv(): MutableMap { - if (SystemInfo.isUnix) { - return super.readShellEnv() - } - else { - if (activate != null) { - return readVirtualEnvOnWindows(activate); + try { + if (SystemInfo.isUnix) { + return super.readShellEnv() } else { - LOG.error("Can't find activate script for $virtualEnvSdkPath") - return mutableMapOf(); + if (activate != null) { + return readVirtualEnvOnWindows(activate); + } + else { + LOG.error("Can't find activate script for $virtualEnvSdkPath") + } } + } catch (e: Exception) { + LOG.warn("Couldn't read shell environment: ${e.message}") } + + return mutableMapOf() } override fun dumpProcessEnvToFile(command: MutableList, envFile: File, lineSeparator: String?): MutableMap {