Using bash in WebStorm terminal - windows

I downloaded git bash for Windows and attempted to set this as the shell in WebStorm. I went to Settings -> Tools -> Terminal, and set the Shell path to git-bash.exe. Then, when I pressed OK an opened the terminal in WebStorm, I got the message:
Cannot open Local Terminal
Failed to start [git-bash.exe] in C:\Users...
Error running process: CreateProcess failed. Code 2
Perhaps I need the environmental variables set up but I wasn't sure how this would be done.
What steps are needed in order to enable this shell in the WebStorm terminal?

Please use full\path\to\Git\bin\sh.exe as Shell path in Settings | Tools | Terminal.
git-bash.exe won't work, because it is a terminal emulator for sh shell with its own window/UI, not a shell. WebStorm provides its own terminal emulator in Terminal tool window. It's impossible to integrate one terminal emulator inside another, because all integration is based on parsing ANSI/VT sequences from underlying shell.

Related

Getting weird characters in Git for Windows bash when running cypress from command line

I'm using cypress for test automation and when running a test spec from the Git for Windows bash terminal I get weird characters in the results output:
cypress spec run in Git for Windows bash -
If I run cypress from a Windows command prompt the output characters are correct:
cypress spec run in Windows Command Prompt -
I'm using Windows 7, cypress 5.1.0, and Git for Windows 2.28.0 with mintty 3.2.0
Any thoughts on how to correct this?
The issue is described in this GitHub issue.
The problem is that Cypress is sending UTF-8 encoded text through its stdout which is mangled by Windows before being received by Mintty (which is what hosts bash and runs git on Windows).
I understand that Mintty doesn't yet instruct Windows to not mangle the stdout it processes - (cmd.exe does, however, which is why it works there) - but we can do that ourselves by changing our Windows OEM Code Page setting using the chcp program (located at C:\Windows\System32\chcp.com and yes, that's a .com, not .exe). You can add a command to your .bashrc file so it will always run when you fire up Mintty:
Open mintty on Windows - presumably this starts a bash shell.
Go to your home directory (i.e. cd ~)
Open or create a .bashrc file.
Put this in the file (update the path to your chp.com program as appropriate):
/c/Windows/System32/chcp.com 65001
Then restart the terminal window and it should work.
As both #digijay and #Dai replied above the cause of the issue is described here https://github.com/git-for-windows/git/issues/2806
The issue was resolved with the next release of git-for-windows. Prior to the fix being released, I solved the issue for myself by simply running this at the bash command line before running my cypress run command:
> cmd //c chcp 65001

Can Intellij automatically run commands when opening the embedded terminal?

I use the embedded terminal intellij on Windows and I always run a set of commands as soon as it opens. Commands such as setting aliases etc etc. Is it possible to get intellij to run the automatically?
No, it's not currently supported; please follow IDEA-210036 for updates.
Note that you can set up init script in the AutoRun registry value to execute a set of commands on each cmd.exe start - see
How to run a command on command prompt startup in Windows. But this will affect all your cmd shell instances, not just the cmd.exe in the terminal embedded in WebStorm

WSL Bash with ZSH integrated in ConEmu - Open Here Issue

I am using Ubuntu Bash with ZSH installed on WSL, Windows 10.
Command in (ConEmu Task settings):
"%WINDIR%\System32\wsl.exe ~" -cur_console:p
Command in (ConEmu Integration settings):
-Single -run {Bash::ubuntu} -cur_console:n
All other terminals integrated in ConEmu I can open with right click in the current project folder, but Ubuntu Bash opens always in default folder (~).
I tried the settings described here:
ConEmu + WSL: Open new console in current tab directory
So, with the command:
set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl -C~ -cur_console:pm:/mnt
It works the same as in my case.
With the correct one:
set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl -cur_console:pm:/mnt
The terminal opens in current folder and it works, but opens in Bash, no more ZSH.
I would appreciate your help.
Finally it works with ZSH! My settings:
Tasks
Bash::ubuntu
-icon "%USERPROFILE%\ubuntu\ubuntu.ico"
"%WINDIR%\System32\wsl.exe" -cur_console:pm:/mnt
Integrations
Bash Here
-Single -run {Bash::ubuntu} -cur_console:n
%USERPROFILE%\ubuntu\ubuntu.ico

adb: command not found- Window 10 shell

I am trying to run the adb command using adb shell. Running well on mac but not in the window.
Add the path to the folder containing adb.exe to the PATH environment variable. If you don't have adb.exe in your computer, download one.
(Off topic) Besides, you seems trying to run a Linux shell script on Windows, please use some software like Cygwin or MSYS2.

Terminal app in Mac OS X Lion 10.7 stuck?

Some days ago I tried to create a shell script which would open all the torrents files in my downloads folder. I am not sure if I get the sh file written right, since then I am getting this message:
Last login: Fri May 18 22:54:28 on ttys000
LSOpenURLsWithRole() failed for the application /Users/Alex/Downloads/(Demonoid.me)-Adobe_Master_Collection_CS5_(OS_X)__12302562.8934.torrent
with error -10810 for the files
/Users/Alex/Downloads/Coda_1_6_2_[_Plist]_[Serial]_O-Demonoid.me-O_12302562.8934.torrent,
/Users/Alex/Downloads/Coda_1_7_3_[k'd]-((Demonoid.me))_12302562.8934.torrent,
/Users/Alex/Downloads/[kat.ph]grid.systems.in.graphic.design.josef.muller.brockmann.torrent,
and /Users/Alex/Downloads/[kat.ph]pixie.lott.cry.me.out.mp3.housezz.torrent.
job done
/bin/bash: line 8: end: command not found
[Process completed]
And I can't do anything in Terminal. I don't know what to do. Any insights about it?
Open a terminal and let it hang.
Open the terminal preferences menu (Command-comma).
In the Startup tab, remember your current shell setting.
Choose a shell other than Bash or Sh (e.g. /bin/tcsh — this is a desparation measure, and only temporary).
Close the locked terminal.
Open a new terrminal (Command-N).
That should give you a command prompt.
In that window, edit your .profile or .bashrc or whatever you added the Torrent lines to.
Remove the Torrent-related lines.
Go back to terminal preferences.
Reset the shell to /bin/bash.
Try opening a terminal window once more.
When it comes to trying to add the Torrents again, write a shell script. Debug it. Only put it in your profile when you're sure it is correct, stable, reliable, and doesn't lock your terminal. Then test it with a terminal already open — opening a new terminal to do the test. You've then still got an unlocked terminal you can fix problems with.
If you have a graphical Vim (Gvim or MacVim), you may be able to launch that and then edit your .profile without having to tweak the Terminal preferences.

Resources