IDEA-167089 MacOSX: support tcsh shell for loading environment variables

This commit is contained in:
Sergey Simonchik
2017-01-25 13:20:16 +03:00
parent 357ece6bfd
commit 4f3f60dc83
2 changed files with 11 additions and 4 deletions
@@ -27,6 +27,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.util.concurrency.AppExecutorUtil;
import com.intellij.util.concurrency.FixedFuture;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.io.BaseOutputReader;
import com.intellij.util.text.CaseInsensitiveStringHashingStrategy;
import gnu.trove.THashMap;
@@ -210,14 +211,20 @@ public class EnvironmentUtil {
return parseEnv(lines, lineSeparator);
}
@NotNull
protected List<String> getShellProcessCommand() throws Exception {
String shell = getShell();
if (shell == null || !new File(shell).canExecute()) {
throw new Exception("shell:" + shell);
}
return new ArrayList<String>(Arrays.asList(shell, "-l", "-i"));
List<String> commands = ContainerUtil.newArrayList(shell);
if (!shell.endsWith("/tcsh")) {
// Act as a login shell
// tsch does allow to use -l with any other options
commands.add("-l");
}
commands.add("-i"); // enable interactive shell
return commands;
}
@Nullable
@@ -86,7 +86,7 @@ class PyVirtualEnvReader(val virtualEnvSdkPath: String) : EnvironmentUtil.ShellE
}
override fun getShellProcessCommand(): MutableList<String>? {
override fun getShellProcessCommand(): MutableList<String> {
val shellPath = shell
if (shellPath == null || !File(shellPath).canExecute()) {