First try to find /bin/bash

/bin/sh on Linux is not the same.
This commit is contained in:
Dmitry Trofimov
2016-10-11 04:14:51 +02:00
parent 5f705629f4
commit 02de2e3346
@@ -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<String, String> {
@@ -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()
}