Actions
Bug #16087
closedSignal.trap(:INT) doesn't work on msys2 mingw64 ?
Status:
Third Party's Issue
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.3p62 (2019-04-16 revision 67580) [x64-mingw32]
Backport:
Description
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.
Updated by MSP-Greg (Greg L) over 5 years ago
I checked:
ruby 2.7.0dev (2019-08-09T15:04:06Z master 8d7e0159c0) [x64-mingw32] ruby-loco
ruby 2.6.3p62 (2019-04-16 revision 67580) [x64-mingw32] RubyInstaller2 / OneClick
JFYI, tried both in a PowerShell window, and trunk in a cmd window.
All worked as expected. Not sure why the difference...
Updated by nobu (Nobuyoshi Nakada) over 5 years ago
- 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.
Actions
Like0
Like0Like0