When I try to run it in the IDE thru the “Run File”, I get:
/bin/sh C:/dev/source/my/demo/file.sh
Not found
I guess the interpreter has not been found because my default interpreter configured in the terminal is Cmder, ok, not ideal but I change my default terminal to WSL and get:
/bin/sh: 0: Can’t open C:/dev/source/my/demo/file.sh
The plugin did not make the path conversion.
How can I run .cmd / .bat with the interpreter of my choice cmd.exe or Cmder.bat or C:\tools\Cmder\cmder_shell.bat and .sh with bash or WSL and have also the plugin to do the path conversion ?
I also created a Run Config but with the same result, the only way I found to run file.sh in WSL is first to create a .cmd file from which I call
wsl sh file.sh
not ideal at all, I can do the same without the plugin.
Thanks for posting!
I can see that this is frustrating.
BashSupport Pro uses the JetBrains Shell plugin for the basic infrastructure. At this time, the run configurations of that plugin are used to execute scripts and JetBrains Shell isn’t properly supporting path mapping.
BashSupport Pro has path-mapping for DEBUG, i.e. the script should run when you right-click into the editor and choose “Debug ‘file.sh’…”. But that’s not a good option to run scripts.
BashSupport Pro maps paths for WSL, MSYS, and Cygwin setups.
Here’s what I can do:
As a short term fix, I’ll check if there’s a good way to force the Shell plugin use mapped paths.
I was planning to ship a new run configuration type with the next update of BashSupport Pro. It’ll migrate run configs of the old, open-source BashSupport and also handle WSL path mapping on Windows, and a few more helpful features.
Could you provide a few details on your setup, so that this will be properly supported with the update? I haven’t used Cmder yet, but will soon try it.
Cmder is just the terminal and uses WSL’s sh to run bash, right?
Is sh in your path at C:\Windows\System32\sh.exe or is it somewhere else?
Which Linux distribution have you installed via WSL?
Are you using Cmder inside of IntelliJ or are you launching cmds so that they’re opening a new window outside of your IDE?
the configurations created by the context menu in an editor
A run configuration now has new settings under the “Run/Debub” tab.
By default, the path mapping is picked automatically to match the configured interpreter and default terminal shell (if available).
I’ve tested this on Windows 10 with cmd, Cmder, WSL Bash and Git Bash as terminal shells. It’s still possible that some things are not yet fully working and the Shell plugin isn’t very cooperative to override things here.
Do you think that these changes are what you need or is there still something missing to make things work for you?
You can configure the mapping for run configurations. If “Run file” is used then “Automatic” is the default. Automatic mapping is supposed to handle all possible scenarios.
Oh, sorry about that. The preview for 2020.2 needs the 2nd eap or later, https://www.jetbrains.com/idea/nextversion/
I usually release for the current eap, because things easily break in between eaps of the IDE.
Cmder is just the terminal and uses WSL’s sh to run bash, right?
No exactly, Cmder is using ConEmu which allow me out of IJ to open cmd, wsl, bash and powershell
Are you using Cmder inside of IntelliJ or are you launching cmds so that they’re opening a new window outside of your IDE?
For this issue, i’m using Cmder from IJ, the Terminal is set to: C:\tools\Cmder\cmder_shell.bat
Which contains: @cmd.exe /k %0..\vendor\init.bat
basically, it opens Cmder from cmd.exe on the current IJ path.
Is sh in your path at C:\Windows\System32\sh.exe or is it somewhere else?
I use sh from WSL2
Which Linux distribution have you installed via WSL?
lsb_release -a:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
What I would like is to be able to map .cmd/.bat with my preferred windows interpreter (cmd.exe/Cmder) and .sh with my preferred shell interpreter (linux/bash/…)
And that, either from the Run configuration or from the Editor.
That’s what the current preview of BashSupport Pro does. But as there are many different types of shells and path mappings on Windows, there still might be setups, which aren’t handled yet.
Details you can ignore:
If you run it from the editor (i.e. not as a run configuration), then:
if bash.exe or sh.exe (WSL/Cygwin/Git Bash) are used as the Shell of the terminal, then the interpreter path is mapped to match the shell path mapping.
the interpreter path is pasted as native path for other shells, e.g. cmd.exe or cmder_shell.bat
The script path is then mapped to match the type of interpreter.
Automatic in the Run settings should handle most of that. I’m planning to split this to let users configure mapping of interpreter and script path separately.
When I’m on a shell script, I would like to be able to choose my interpreter, like here on a .sh, those detected or those I would have added in a custom IJ settings, at the moment, it proposes nothing and runs the interpreter set in the Terminal settings.
There should have been additional “Debug” and “Edit…”/“Create…” items in the popup with the latest version of the plugin.
So far an automatically detected shell was used. I’m changing that now and adding settings to define the shell interpreters. I’ll keep this thread updated when I have the settings ready for testing.
But a complete fix for this will only be available when I add a new type of run configurations. The Shell plugin’s run config is rather limited and hard to extend.
I haven’t managed to install the EAP plugin versions as you can see above and I’m currently using the stable version that I got from the IntelliJ Plugin manager.
If ever it is on your EAP plugin version, could you please rebuild on the last IJ EAP, so, I can test it?
Version 1.4.2.202 is compatible with 202.5103.13 and later. The latest EAP of IntelliJ is 202.5428.22. But looking at the screenshot above you seem to be using 202.4357.23, which is too old.
If you update to the current eap, then downloading the plugin file and Settings...>Plugins>Install from disk should work for you.
Please let me know if it doesn’t.
I’m having a very hard time with that plugin, I hope it will result into something good
So, at the start I was on the EAP 202.4357.23 with the stable version of BashSupport-pro
Then I tried to update my IJ to the last EAP but it hanged with log [1], I reverted and tried nonetheless to install the 1.4.2.202 plugin version (screenshot above)
Then from for comment, I tried again to update IJ to the last EAP, it failed with the same log as before [1]
I remove that IJ version from my disk and did a fresh install of the last EAP
Re-installed every plugin except BashSupportPro and all my settings, all of that manually.
Until there, all good.
Then, re-installed from disk the 1.4.2.202 plugin version, it asked me to install the JetBrains Shell Plugin and restart
My IJ hangs again at startup with the same log as before [1]
I would like to uninstall it manually because the IDE does not start but cannot find the plugin in the plugin directory, can you help?
Regards,
Fred.
[1]
2020-06-13 12:06:37,210 [ 0] INFO - #com.intellij.idea.Main - ------------------------------------------------------ IDE STARTED ------------------------------------------------------
2020-06-13 12:06:37,242 [ 32] INFO - #com.intellij.idea.Main - IDE: IntelliJ IDEA (build #IU-202.5428.22, 10 Jun 2020 17:37)
2020-06-13 12:06:37,243 [ 33] INFO - #com.intellij.idea.Main - OS: Windows 10 (10.0, amd64)
2020-06-13 12:06:37,243 [ 33] INFO - #com.intellij.idea.Main - JRE: 11.0.7+10-b931.3 (JetBrains s.r.o.)
2020-06-13 12:06:37,243 [ 33] INFO - #com.intellij.idea.Main - JVM: 11.0.7+10-b931.3 (OpenJDK 64-Bit Server VM)
2020-06-13 12:06:37,244 [ 34] INFO - #com.intellij.idea.Main - JVM Args: exit -Xms128m -Xmx750m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -XX:CICompilerCount=2 -Dsun.io.useCanonPrefixCache=false -Djdk.http.auth.tunneling.disabledSchemes="" -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Djdk.attach.allowAttachSelf=true -Dkotlinx.coroutines.debug=off -Djdk.module.illegalAccess.silent=true -Dide.no.platform.update=true -Djb.vmOptionsFile=C:\Users\doublefx\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-1\202.5428.22.vmoptions -Djava.library.path=C:\Users\doublefx\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-1\202.5428.22\jbr\\bin;C:\Users\doublefx\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-1\202.5428.22\jbr\\bin\server -Didea.jre.check=true -Dide.native.launcher=true -Didea.paths.selector=IntelliJIdea2020.2 -XX:ErrorFile=C:\Users\doublefx\java_error_in_idea_%p.log -XX:HeapDumpPath=C:\Users\doublefx\java_error_in_idea.hprof
2020-06-13 12:06:37,246 [ 36] INFO - #com.intellij.idea.Main - locale=fr_FR JNU=Cp1252 file.encoding=Cp1252
idea.config.path=C:\Users\doublefx\AppData\Roaming\JetBrains\IntelliJIdea2020.2
idea.system.path=C:\Users\doublefx\AppData\Local\JetBrains\IntelliJIdea2020.2
idea.plugins.path=C:\Users\doublefx\AppData\Roaming\JetBrains\IntelliJIdea2020.2\plugins
idea.log.path=C:\Users\doublefx\AppData\Local\JetBrains\IntelliJIdea2020.2\log
2020-06-13 12:06:38,206 [ 996] INFO - #com.intellij.idea.Main - JNA library (64-bit) loaded in 960 ms
2020-06-13 12:06:38,209 [ 999] INFO - penapi.util.io.win32.IdeaWin32 - Native filesystem for Windows is operational
2020-06-13 12:06:38,444 [ 1234] INFO - #LicenseManager - License required for BashSupport Pro; details: N/A
2020-06-13 12:06:38,469 [ 1259] INFO - #com.intellij.idea.Main - CPU cores: 12; ForkJoinPool.commonPool: java.util.concurrent.ForkJoinPool@237b11c0[Running, parallelism = 11, size = 0, active = 0, running = 0, steals = 0, tasks = 0, submissions = 0]; factory: com.intellij.concurrency.IdeaForkJoinWorkerThreadFactory@71305c53
2020-06-13 12:06:38,995 [ 1785] WARN - #com.intellij.idea.Main -
java.lang.reflect.InvocationTargetException
at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1373)
at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1348)
at com.intellij.idea.StartupUtil.runInEdtAndWait(StartupUtil.java:805)
at com.intellij.idea.StartupUtil.access$000(StartupUtil.java:78)
at com.intellij.idea.StartupUtil$1.invokeAndWait(StartupUtil.java:292)
at com.intellij.util.ui.EdtInvocationManager.invokeAndWaitIfNeeded(EdtInvocationManager.java:68)
at com.intellij.util.ui.UIUtil.invokeAndWaitIfNeeded(UIUtil.java:2269)
at com.intellij.ide.b.a.Y.a(Y.java:260)
at com.intellij.ide.b.l.h.b(h.java:313)
at com.intellij.ide.b.l.h.a(h.java:131)
at com.intellij.ide.b.o.a.a(a.java:99)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.intellij.idea.MainImpl.start(MainImpl.java:103)
at com.intellij.idea.StartupUtil.startApp(StartupUtil.java:297)
at com.intellij.idea.StartupUtil.prepareApp(StartupUtil.java:237)
at com.intellij.ide.plugins.MainRunner.lambda$start$0(MainRunner.java:47)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalArgumentException: Argument for @NotNull parameter 'obj' of com/intellij/util/containers/SmartHashSet.remove must not be null
at com.intellij.util.containers.SmartHashSet.$$$reportNull$$$0(SmartHashSet.java)
at com.intellij.util.containers.SmartHashSet.remove(SmartHashSet.java)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.intellij.ide.b.a.O.d(O.java:168)
at com.intellij.ide.b.a.O.<init>(O.java:78)
at com.intellij.ide.b.a.c.<init>(c.java:251)
at com.intellij.ide.b.a.a.a(a.java:52)
at com.intellij.ide.b.a.a.b(a.java:45)
at com.intellij.ide.b.l.h.c(h.java:318)
at com.intellij.ide.b.a.Y.a(Y.java:267)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:303)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:417)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
@doublefx Yes, this is a pretty bad experience. I hope that it’ll improve soon.
After I posted my reply yesterday a user reported that hang. I was able to reproduce this and reported it to https://youtrack.jetbrains.com/issue/IDEA-243468 . I don’t think that it’s just BashSupport Pro.
So for new users without a license the current IntelliJ EAP is broken and unusable. I think it’s best to wait until JetBrains has fixed the eap. I’ll try to have something more usable until then.
Sorry for the delay, your last message went into my junks
I just installed and tested it.
Some notes:
It reset my Terminal to the default cmd.exe, I set it back to Cmder
The Run for my .sh script opened the terminal with the default terminal interpreter settings and therefore does not work, not proposing with which interpreter I want it to run with.
Weirdly, when used “debug” and despite the plugin does not proposes me any interpreter selection, it worked, it opened it with bash.exe and I’ve been able to debug