msys not opening programs interactively - shell

msys is not opening programs interactively. For example, if I enter python, the program hangs. Even mysql hangs after I enter my password (entering the password is interactive, though). When I enter pico, I get "Redirection is not supported." bc does not hang, though. python -i opens an interactive session.
I've tried different terminal emulators, and I get the same results. I've tried Console and Mintty. Therefore, I'm led to believe this is an issue with sh, not the terminal emulator.
I am running Vista. I installed msys on my work PC, which runs Windows 7, and I don't have any issues with running interactive programs on msys.
I've read that this is expected behavior, but this used to work. I'm thinking that some install corrupted something. I even tried reinstalling msys, and I get the same results. I also cannot do system restore for some reason.
Any clues?
Here is some example output:
$ python
<ctrl-C> from this
$ mysql -u root -p
Enter password: ****
<ctrl-C> from this
This time I used Console. In the "Shell:" textbox I put C:/msys/1.0/bin/sh.exe --login -i When I press the enter key, a newline is added, i.e., the terminal scrolls. The same thing happens from the terminal provided by msys. This used to work before. Furthermore, I installed msys on another machine, which runs Windows 7, and python does not hang. If I use python -i, there is no hang.
Here's the output of running sh from cmd:
C:\Users\jpp>sh
sh-3.1$
sh-3.1$
sh-3.1$ python
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>>

Have you tried the winpty (https://github.com/rprichard/winpty) project? For details, check my answer here: https://stackoverflow.com/a/23164362/1034436
Your issue seems similar to mine with mysql, hg and python, but unlike you, I don't have an example of it working without winpty.

Related

How to enter Windows-Subsystem-for-Linux (ubuntu) from PowerShell at the current PowerShell working dir

When running the command bash or ubuntu in PowerShell, the Windows-Subsystem-for-Linux is entered, however, the current working dir for PowerShell is not carried across to BASH. Is there a way to implement this functionality?
From your Windows Powershell or Powershell Core window, type bash (or wsl); for example:
Now, later versions of Windows include WSL.exe, which replaces bash.exe. The behavior of both executable is the same on my system. The official documentation for wsl.exe states:
You can read that documentation here. Net-net,
I'm running Windows 10 Build-17763. If you aren't experiencing the same behavior I am, you might be running an older version of WSL. You can determine the version of WSL from your build number.

IntelliJ Terminal CTRL+C does not work

When using IntelliJs integrated terminal - for example with git - sometimes my CTRL + C keystrokes don't make to the terminal. For example the current line is not aborted.
What can I do as this behaviour is very annoying.
As I had git for Windows installed anyway I just replaced the terminal used by IntelliJ from cmd.exe (which is the default on windows) to bash.exe supplied by git for Windows (which is cygwin btw)
To change it for all projects go to File >> Other Settings >> Default Settings and then Tools >> Terminal. (see screenshot)
In the shell path field set the following line:
"C:\Program Files\Git\bin\bash.exe" --login -i
Please make sure git is installed at the proper localtion or adjust the path (for example if you have the 32bit version of git installed)
Using bash instead of cmd, the problem does not occour for me. Plus the bash supports some commands that cmd does not support, which is kinda nice when been used to a linux environment.
EDIT 2020-09-30: In latest Intellij versions the Terminal is a project-level setting and can be changed here:
Sometimes it could be because of vim emulator just turn it off
Go to Tools
Deselect Vim Emulator
Because Vim mode is checked,
Tools, Vim Emulator, there will be a √ in front of it, just cancel it, as shown in the figure:picture
I hope i can help u.

How to enable bash commands in Windows CMD?

I've two Windows machines and both have bash installed. However, they differ in the way bash starts up:
Machine 1:
Typing "bash" starts the bash. Then I can type commands like ls.
Machine 2:
It seems like it starts bash and directly runs ls in it, by only typing "ls". After that it switches back to CMD automatically, like this:
Does anyone know which setting enables the behavior of machine 2? Everything looks the same for me. It's a nice feature and I want to enable it on machine 1 as well.
Bash on Ubuntu on Windows executables (binaries) cannot run from Windows applications such as cmd.exe or PowerShell.exe - Windows doesn't even see them as executable.
The likeliest explanation is that you've installed a separate Unix emulation environment such as GnuWin, which comes with native Windows binaries.
To see the location of your - by definition Windows-native - ls executable, run where ls, which will probably tell you what product it came with, such as
C:\Program Files (x86)\GnuWin32\bin\ls.EXE.
Note that the Ubuntu on Windows binaries are stored in a user-specific manner in
%LOCALAPPDATA%\lxss\rootfs\bin, but that is a moot point, given that you cannot invoke them from Windows.
In Windows 10, there is a built-in Linux subsystem (one of the greatest features of Windows 10). It gives you almost a complete Linux shell for various distributions, and you can almost do anything with it (user mode).
I bet it is installed on your first computer, and you are using that subsystem. In the latest version of this subsystem, you can run both Linux executables and Windows exe files.

SVN 1.8 defaulting to non-interactive

I'm using the Windows SVN 1.8 command line client that comes with TortoiseSVN through Cygwin. Right now, it doesn't do any interactive prompting because it doesn't see Cygwin as a terminal device. As in the help for --non-interactive: do no interactive prompting (default is to prompt only if standard input is a terminal device). If I pass in --force-interactive, the command hangs.
Is there a way that I can make SVN see Cygwin as a terminal device?
NOTE: I edited the question from my original post because I foolishly assumed --force-interactive worked in this scenario. I've narrowed it to the root of the problem.

what's your utf-8 console setting when programming Google Go under Windows

We know google's Go default is UTF-8.
I found in my Windows XP. It can not display correct about the UTF-8.
The following code display in wrong.
package main
func main() {
println("中文")
}
I've googled. It said use another font + reg + chcp 65001.
But, I failed.
I've tried cmd and powershell v1 (it is the only provide version under XP).
Both can NOT display well.
Install MSYS
Download mintty and put mintty.exe in c:\MinGW\msys\1.0\bin
Adjust MinGW Shell icon, set target as C:\MinGW\msys\1.0\msys.bat -mintty, then click the icon
Menu->Option->Text->Font, Locale,Character set(UTF-8)
Download go Windows 386
cd /c/go/src ; mkdir ; test your code here.
BTW, setting vim with utf-8
I will try this the next time I'm at a Windows XP machine. I develop mostly on Win 7 and CentOS. One thought, cmd.exe is awfully old on Windows XP. I wonder if it would work better if run from PowerShell. Also, in the last couple days I've switched to using MSys on Windows so that I can take advantage of unified makefiles on Linux and Windows. I'll post an update if I get the command to work on XP or 7.

Resources