From 02de2e334657f32c346142d25b0ac0ca6942ec06 Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Mon, 10 Oct 2016 22:11:24 +0200 Subject: [PATCH] First try to find /bin/bash /bin/sh on Linux is not the same. --- .../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 c91d77c3a34a..0bd285226fe9 100644 --- a/python/src/com/jetbrains/python/run/PyVirtualEnvReader.kt +++ b/python/src/com/jetbrains/python/run/PyVirtualEnvReader.kt @@ -33,12 +33,16 @@ class PyVirtualEnvReader(val virtualEnvSdkPath: String) : EnvironmentUtil.ShellE val activate = findActivateScript(virtualEnvSdkPath, shell) override fun getShell(): String? { - val defaultShell = "/bin/sh" - if (File(defaultShell).exists()) { - return defaultShell; - } else { - return super.getShell(); + if (File("/bin/bash").exists()) { + return "/bin/bash"; } + else + if (File("/bin/sh").exists()) { + return "/bin/sh"; + } + else { + return super.getShell(); + } } override fun readShellEnv(): MutableMap { @@ -81,11 +85,12 @@ class PyVirtualEnvReader(val virtualEnvSdkPath: String) : EnvironmentUtil.ShellE } return if (activate != null) - if (File(shellPath).name == "sh") { - mutableListOf(shellPath, "-i", "-c", "source '$activate'") - } else { + if (File(shellPath).name == "bash") { mutableListOf(shellPath, "--rcfile", activate, "-i") } + else { + mutableListOf(shellPath, "-i", "-c", "source '$activate'") + } else super.getShellProcessCommand() }