Windows git bash as Terminal shell causes 'Error running process: CreateProcess failed. Code 267'
Answered
Hi,
I'm trying to setup git-bash as the Terminal shell in IntelliJ IDEA, and I get an error while launching it.
Configuration details:
IntelliJ IDEA 2019.3.4 (Ultimate Edition)
Build #IU-193.6911.18, built on March 17, 2020
Licensed to PJD
You have a perpetual fallback license for this version
Subscription is active until December 20, 2020
Runtime version: 11.0.6+8-b520.43 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1962M
Cores: 12
Registry:
Non-Bundled Plugins: com.intellij.plugins.watcher, BashSupport, com.intellij.plugins.html.instantEditing, com.jinsihou.react.snippets, intellij.prettierJS, io.github.qeesung.component.HighlightBracketPair, mobi.hsz.idea.gitignore, ru.adelf.idea.dotenv
The error I get:
Cannot open Local Terminal
Failed to start [C:\Program Files\Git\bin\bash.exe] in <myProjectPath>
Error running process: CreateProcess failed. Code 267
See your idea.log (Help | Show Log in Explorer) for the details.
Log file extract:
2020-04-07 20:52:57,121 [ 903079] INFO - m.pty4j.windows.WindowsVersion - Windows version: 10.0.18362
2020-04-07 20:52:57,309 [ 903267] INFO - erminal.AbstractTerminalRunner - Cannot open Local Terminal
java.util.concurrent.ExecutionException: Failed to start [C:\Program Files\Git\bin\bash.exe] in <myProjectPath>
at org.jetbrains.plugins.terminal.LocalTerminalDirectRunner.createProcess(LocalTerminalDirectRunner.java:197)
at org.jetbrains.plugins.terminal.LocalTerminalDirectRunner.createProcess(LocalTerminalDirectRunner.java:47)
at org.jetbrains.plugins.terminal.AbstractTerminalRunner.lambda$openSessionInDirectory$4(AbstractTerminalRunner.java:214)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:238)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.io.IOException: Couldn't create PTY
at com.pty4j.windows.WinPtyProcess.<init>(WinPtyProcess.java:74)
at com.pty4j.windows.WinPtyProcess.<init>(WinPtyProcess.java:49)
at com.pty4j.PtyProcessBuilder.start(PtyProcessBuilder.java:109)
at com.pty4j.PtyProcess.exec(PtyProcess.java:78)
at com.pty4j.PtyProcess.exec(PtyProcess.java:49)
at org.jetbrains.plugins.terminal.LocalTerminalDirectRunner.createProcess(LocalTerminalDirectRunner.java:189)
... 8 more
Caused by: com.pty4j.windows.WinPtyException: Error running process: CreateProcess failed. Code 267
at com.pty4j.windows.WinPty.<init>(WinPty.java:127)
at com.pty4j.windows.WinPtyProcess.<init>(WinPtyProcess.java:71)
... 13 more
I've read some posts in the community about Anti-Virus scan exceptions, so I have added both IntelliJ and Git root folders in Windows Defender exclusion list, but it didn't help.
Has anyone solved this issue?
Please sign in to leave a comment.
You may need to exclude the process instead of the folder as well as the DLL paths explicitly.
https://youtrack.jetbrains.com/issue/IDEA-220774#focus=streamItem-27-3672969.0-0
Unfortunately it didn't make it.
In the mean tim I updated to version 2020.1, and still having the same issue.
Try excluding IntelliJ IDEA as well: https://intellij-support.jetbrains.com/hc/en-us/articles/360005028939-Slow-startup-on-Windows-splash-screen-appears-in-more-than-20-seconds .
Unfortunately, it didn't help :(
Please contact your IT/security helpdesk so that they can help you to properly configure the antivirus to allow IntelliJ IDEA starting external processes.
I don't have such service at hand, but thanks :)
Check that
<myProjectPath>
exists. I have had the same trouble because of start directory in project settings was wrong.
Hi! you made my day!
Indeed my laptop system hard drive recently crashed, and I have moved my project (with uncomitted work) into a new configuration.
The solution was to edit .idea/terminal.xml which had the old (and very similar) path. Some other configuration files also had the old path.
Many thanks for your suggestion.
Thanks for the details, I've reported https://youtrack.jetbrains.com/issue/IDEA-239942. We'll fix it in the future updates.
I had the same "symptoms", but unfortunately the advice from Sl0 Spb did not help me - the start directory in the project settings was correct.
But in File -> Settings -> Tools ->Terminal -> Application Settings -> Shell path I noticed that for some reason the first / opening quote of the file path was suddenly missing (c:\Program Files\Git\bin\sh.exe" --login instead of "c:\Program Files\Git\bin\sh.exe" --login).
I never changed the settings. This must have happened during the last update. My PyCharm version (Help -> About):
PyCharm 2020.2.1 (Community Edition)
Build #PC-202.6948.78, built on August 25, 2020
Runtime version: 11.0.8+10-b944.31 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1490M
Cores: 4
I thought it might help someone who ends up here as well when looking for a solution.
@Gjanetta are you sure you have not amended the settings? Is the problem reproducible on your side?
@... Yes, I have just reproduced it to be sure. I undid the update and entered the shell path correctly, ran the update again and the first quote was gone, just as the last time, and the terminal could not be opened until I entered the quote manually in the settings.
@Gjanetta please check if you have settings sync or settings repository on, possibly the wrong setting is being set from the repository. If it doesn't help, please attach your logs (Help | Collect Logs and and Diagnostic Data).
I was having the same problem. What worked was to set the shell path as
```C:\Users\<my_user_name>\AppData\Local\Microsoft\WindowsApps\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\ubuntu.exe```.
This gives me the desired terminal configuration but it does not start at the location specified in the "Start directory" setting. Is this a bug?
@... regarding your comment of 25.09.2020: Sorry for my late reply, this whole issue has been completely sidelined amidst my busy schedule over the past few months.
I was sure, I did not have settings sync or settings repository on - but I have double-checked to be on the safe side: Definitely neither settings synchronization nor a settings repository.
By the way, I did not have this problem after upgrading to 2020.3.
For me, the matter is closed, but if I can contribute anything else helpful to the general user community of PyCharm, I'm happy to do so.
Update I fixed this my issue. It turns out my default distribution was pointing to a non working Ubuntu-18.04 distro
So I updated the default to Ubuntu-20.04 (a working distro)
#Lists installed distros
wslconfig /l
#Sets default distro
wslconfig /s Ubuntu-20.04
In IntelliJ I set the terminal shell path to just, which now opens fine in the correct path
Mine needed to be "C:\Users\<user>\AppData\Local\Programs\Git\bin\sh.exe" --login -i
In my case, I was signed in as a separate user on my PC and not as admin.
The issue pointed out by Gjanetta was also helpful