[ruby-core:94246] [Ruby master Bug#16087] Signal.trap(:INT) doesn't work on msys2 mingw64 ?

[email protected]
Newsgroups gmane.comp.lang.ruby.core
Message-ID <redmine.journal-80554.20190810055720.6a7d1a68be84299a@ruby-lang.org>
Issue #16087 has been updated by nobu (Nobuyoshi Nakada).

Status changed from Open to Third Party's Issue

This was due to the limit of mintty.
There can be a chance that this will be solved by mintty (and other terminal emulators for Windows) using Windows Pseudo Console in the future, I guess.

----------------------------------------
Bug #16087: Signal.trap(:INT) doesn't work  on msys2 mingw64 ?
https://bugs.ruby-lang.org/issues/16087#change-80554

* Author: roswell (Takahiro Yamaguchi)
* Status: Third Party's Issue
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [x64-mingw32]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
My environment is Windows 10 msys2 mingw64

```
yama@JPC00183513 ~/b/p/sample> uname -a
MINGW64_NT-10.0-17763 JPC00183513 3.0.7-338.x86_64 2019-05-27 06:58 UTC x86_64 Msys
yama@JPC00183513 ~/b/p/sample> ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [x64-mingw32]
```

My script is 

```
yama@JPC00183513 ~/b/p/sample> cat signal.rb
# coding: utf-8
$stdout.sync = true

p Signal.list

# EXIT       mignw fail
# INT w pass mingw fail
# QUIT       mingw unsupported signal `SIGQUIT' (ArgumentError)
# ILL        mingw can't trap reserved signal: SIGILL (ArgumentError)
# ABRT       mingw fail
# FPE        mingw can't trap reserved signal: SIGFPE (ArgumentError)
# KILL       mingw Invalid argument - SIGKILL (Errno::EINVAL)
# TERM       mingw fail
Signal.trap(:INT) {
 puts "まわって"
 puts "まわって"
 puts "まわって"
 exit
}

while true
 puts "とんで"
 sleep 3
end
```

Execute the above script, then type C-c to interrupt it

```
yama@JPC00183513 ~/b/p/sample> ruby signal.rb
{"EXIT"=>0, "INT"=>2, "ILL"=>4, "ABRT"=>22, "FPE"=>8, "KILL"=>9, "SEGV"=>11, "TERM"=>15}
とんで
とんで
yama@JPC00183513 ~/b/p/sample>
```

The "Signal.trap(:INT)" block is NOT executed.

I assume the ruby msys2 mingw64 have a bug around Signal handling.




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.