17

I created a simple test.py with the following:

import sys
res = sys.stdin.read()
print(res)

but when I tried to run

python test.py

then i input

hello

and end the input by Ctrl+z, I got the following message:

4 [sig] bash 11516! sigpacket::process: Suppressing signal 18 to win32 process (pid 10620)

I could not figure out what was wrong.

screenshot

theB
  • 6,450
  • 1
  • 28
  • 38
Vinh Hoang
  • 171
  • 1
  • 3

2 Answers2

14

Signal 18 is just the handler for Ctrl+Z. (Technically it maps to SIGTSTP.) The signal tells the process to suspend. Since the signal is generally meaningless to a Windows process, git-bash suppresses the message, but it still lets you know that it suppressed that signal.

Unfortunately, MinTTY, the default git-bash terminal, doesn't connect up the console correctly for native Windows console applications. So even ignoring the warning message, the python interpreter isn't really working correctly anyway. (More info)

In order to get python hooked up correctly you need to use winpty to launch python. The command:

winpty python test.py

will work. You could also use git-cmd if you need access to git commands, or open a standard Windows command prompt and run python there if you don't.

theB
  • 6,450
  • 1
  • 28
  • 38
  • Thanks @eryksun for the correction, I updated the answer. I'm not very well versed on the intricacies of POSIX signals, so if my explanation of the error message isn't very good, let me know and I can try again. – theB May 01 '18 at 18:54
  • My comment was partly to note that this POSIX signals and pty emulation is functional for programs that use MSYS2. For example, if you run `cat` from this mintty bash session, you can (fake) suspend it with Ctrl+Z, return to bash and resume it with `fg`, and then end reading from stdin with Ctrl+D. It's just not applicable and generally broken when running WinAPI console applications. But your answer is fine, and I already upvoted. – Eryk Sun May 01 '18 at 19:21
  • 2
    If your terminal is stuck at the `[sig] bash 11516! sigpacket::process: Suppressing signal 18 to win32 process`, just type something into the terminal like "hello" then press enter. Any Ctrl- command doesn't work. This is what I actually came to this question for. – interdevwebaloper Jun 24 '20 at 22:21
-2

You can kill it from the Windows taskmgr.exe