3

I can't seem to open the interactive mode of PSQL using MINTTY or using the default Cygwin terminal, it just stalls under the command psql databasename and does nothing. The only way to get it to respond is to ctrl+C out of it. It works fine in Command Prompt.

I know that for Python you need to enter the -i argument - is there a similar trick for Cygwin?

Chris Travers
  • 25,424
  • 6
  • 65
  • 182
TimY
  • 5,256
  • 5
  • 44
  • 57
  • what command are you using? i would expect `mintty -e psql databasename -` to work. – nullrevolution Dec 06 '12 at 20:24
  • Unfortunately, this doesn't work. Also, I am trying to switch to using mintty as my default terminal, so I would be calling `psql databasename` in MINTTY already. – TimY Dec 06 '12 at 22:05

2 Answers2

2

I'm having the same problem. For some reason

psql -l -h localhost -U postgres

returns a listing of dataabases, but any other variation on psql just hangs, silently.


Edit: I found the answer here: how to set up the psql command in cygwin?

Windows psql uses Windows console functions; Cygwin runs best in a terminal like Console2, which doesn't support Windows console API. So psql doesn't work well with Cygwin at all. What's needed is a Cygwin build of client tools like psql

Community
  • 1
  • 1
JonathanZ
  • 1,046
  • 11
  • 20
2

I had a similar issue with Mercurial (hg)+OpenSSH, Python and MinTTY, but under MSYS instead of CygWin. I had this exact same problem with mysql as well. Nonetheless, as far as I can tell, both this and my issue were caused by MinTTY not being to handle applications that uses the native Windows console functions.

I solved my issue by following the solution found in comment 64 of https://code.google.com/p/mintty/issues/detail?id=56#c64

With the winpty (https://github.com/rprichard/winpty) project compiled and installed in my path, I was able to run native Python (in interactive mode), Mercurial and MySQL from the MinTTY shell without special builds or switches (such as python -i). All I need was to append console.exe or console before the python or hg command. For convenience, I added aliases such as alias hg="console.exe hg" so I can use the same commands whether I'm in a Linux shell or a Windows MinTTY bash shell.

martian111
  • 595
  • 1
  • 6
  • 21