Only /bin/bash has --rcfile, so name the script accordingly; On Mac /bin/sh is alias...
authorDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Wed, 19 Oct 2016 17:27:46 +0000 (19:27 +0200)
committerDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Wed, 19 Oct 2016 17:27:46 +0000 (19:27 +0200)
build/groovy/org/jetbrains/intellij/build/CommunityRepositoryModules.groovy
plugins/terminal/resources/jediterm-bash.in [moved from plugins/terminal/resources/jediterm-sh.in with 100% similarity]
plugins/terminal/src/org/jetbrains/plugins/terminal/LocalTerminalDirectRunner.java
plugins/terminal/tests/org/jetbrains/plugins/terminal/TerminalShellCommandTest.java
python/python-terminal/src/com/jetbrains/python/sdk/PyVirtualEnvTerminalCustomizer.kt

index 1918ebb1733fa4d800813ff0756850a891d7ae54..a4b6b6ed5de9e6079d53253da28d09a6cdbcfaa5 100644 (file)
@@ -241,7 +241,7 @@ class CommunityRepositoryModules {
     javaFXPlugin("javaFX-CE"),
     plugin("terminal") {
       withResource("resources/.zshrc", "")
-      withResource("resources/jediterm-sh.in", "")
+      withResource("resources/jediterm-bash.in", "")
     }
   ]
 
index 17b6d134569445767f0bac4b8d596f24e3a04767..1d10271353da354cc3b77ea478509db55e43d8fb 100644 (file)
@@ -72,8 +72,8 @@ public class LocalTerminalDirectRunner extends AbstractTerminalRunner<PtyProcess
 
   private static String findRCFile(String shellName) {
     if (shellName != null) {
-      if ("bash".equals(shellName)) {
-        shellName = "sh";
+      if ("sh".equals(shellName)) {
+        shellName = "bash";
       }
       try {
 
@@ -195,10 +195,9 @@ public class LocalTerminalDirectRunner extends AbstractTerminalRunner<PtyProcess
 
         String rcFilePath = findRCFile(shellName);
 
-
         if (rcFilePath != null &&
             shellIntegration) {
-          if (shellName.equals("bash") || shellName.equals("sh")) {
+          if (shellName.equals("bash") || (SystemInfo.isMac && shellName.equals("sh"))) {
             addRcFileArgument(envs, command, result, rcFilePath, "--rcfile");
           }
           else if (shellName.equals("zsh")) {
index 4c2446380c91680a62f77d108a4aeac07214edac..4b3110b7fb936307e454b27b60c0baa3f7e09baf 100644 (file)
@@ -43,10 +43,10 @@ public class TerminalShellCommandTest extends TestCase {
   }
 
   public void testAddRcConfig() {
-    hasRcConfig("bash -i", "jediterm-sh.in", Maps.newHashMap());
-    hasRcConfig("sh --login", "jediterm-sh.in", Maps.newHashMap());
+    hasRcConfig("bash -i", "jediterm-bash.in", Maps.newHashMap());
+    hasRcConfig("sh --login", "jediterm-bash.in", Maps.newHashMap());
     Map<String, String> envs = Maps.newHashMap();
-    hasRcConfig("sh --rcfile ~/.bashrc", "jediterm-sh.in", envs);
+    hasRcConfig("sh --rcfile ~/.bashrc", "jediterm-bash.in", envs);
     assertEquals("~/.bashrc", envs.get("JEDITERM_SOURCE"));
   }
 
index 806ded0c2563cc9136ea3bb453e02a4398e6039b..1a359be3d0ee743adefdb0f45a4f736762c8f87c 100644 (file)
@@ -45,8 +45,8 @@ class PyVirtualEnvTerminalCustomizer : LocalTerminalCustomizer() {
         val shellPath = command[0]
         val shellName = File(shellPath).name
 
-        if (shellName == "bash" || shellName == "sh") {
-          //for bash and sh we pass activate script to jediterm shell integration (see jediterm-sh.in) to source it there
+        if (shellName == "bash" || (SystemInfo.isMac && shellName == "sh")) {
+          //for bash we pass activate script to jediterm shell integration (see jediterm-bash.in) to source it there
           findActivateScript(path, shellPath)?.let { activate -> envs.put("JEDITERM_SOURCE", activate) }
         }
         else {