[ruby-core:93843] [Ruby master Bug#8708] It seems that a call to the "system" changes the handler of the INT signal
From:
duerst@...
Date:
2019-07-19 06:43:43 UTC
List:
ruby-core #93843
Issue #8708 has been updated by duerst (Martin Dst).
Status changed from Feedback to Closed
I'm using a cygwin version with a date from this year:
```
$ uname -srv
CYGWIN_NT-6.3 3.0.7(0.338/5/3) 2019-04-30 18:08
```
I'm not 100% sure I'm doing the right thing, but I get the following:
```
$ ruby issue8708x.txt
before "system" ctrl-c stops the script immediately
Traceback (most recent call last):
1: from issue8708x.txt:4:in `<main>'
issue8708x.txt:4:in `sysread': Interrupt
$ ruby issue8708x.txt
before "system" ctrl-c stops the script immediately
blabla
but after "system" ctrl-c waits until I press Enter
Traceback (most recent call last):
1: from issue8708x.txt:9:in `<main>'
issue8708x.txt:9:in `sysread': Interrupt
```
In the first case, my input is "Ctrl-C", in the second case, it's "Enter", then "Ctrl-C", but without an additional "Enter". So the issue seems to be resolved. Closing.
----------------------------------------
Bug #8708: It seems that a call to the "system" changes the handler of the INT signal
https://bugs.ruby-lang.org/issues/8708#change-79727
* Author: bdimych (Dmitry Bolshakov)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 1.9.3p429 (2013-05-15) [i386-cygwin]
* Backport:
----------------------------------------
this is only on cygwin, on linux all ok
$ uname -a
CYGWIN_NT-5.1 bolshakovxp 1.7.21(0.267/5/3) 2013-07-15 12:17 i686 Cygwin
--- test script ---
#!/usr/bin/ruby
STDOUT.sync = true
puts 'before "system" ctrl-c stops the script immediately'
STDIN.sysread(1)
# intTrap = trap 'INT', 'DEFAULT' # ---------------------- if uncomment this wrapper
system 'echo blabla'
# trap 'INT', intTrap # ---------------------------------- then ctrl-c works immediately
puts 'but after "system" ctrl-c waits until I press Enter'
STDIN.sysread(1)
--- output ---
$ ./x.rb
before "system" ctrl-c stops the script immediately
./x.rb: Interrupt
$ ./x.rb
before "system" ctrl-c stops the script immediately
blabla
but after "system" ctrl-c waits until I press Enter
I'm pressing ctrl-c right now... but it stops only after Enter
./x.rb: Interrupt
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>