[ruby-core:77014] [Ruby trunk Feature#12693] Want a way to receive EINTR on Process.waitpid
From:
sonots@...
Date:
2016-08-23 07:28:57 UTC
List:
ruby-core #77014
Issue #12693 has been updated by Naotoshi Seo.
It worked like a charm :)
test.rb
```
puts Process.pid
trap(:CONT) do
raise 'CONT'
end
_pid = fork do
sleep 10
end
begin
Process.waitpid(-1)
rescue => e
puts e.backtrace.join("\n")
end
```
Sending signal, I got
```
test.rb:4:in `block in <main>'
test.rb:12:in `waitpid'
test.rb:12:in `<main>'
```
----------------------------------------
Feature #12693: Want a way to receive EINTR on Process.waitpid
https://bugs.ruby-lang.org/issues/12693#change-60243
* Author: Naotoshi Seo
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
http://man7.org/linux/man-pages/man2/waitpid.2.html tells EINTR error if WNOHANG flag was not set and an unblocked signal or a SIGCHLD was caught.
However, ruby implementation of Process.waitpid does not raise EINTR https://github.com/ruby/ruby/blob/c2bf7e6f7d2fbe0b50da59aaa1374222f233aa71/process.c#L910-L911
test.rb
```
puts Process.pid
trap(:CONT) do
puts 'CONT'
end
_pid = fork do
sleep 10
end
Process.waitpid(-1)
```
```
$ ruby test.rb
```
```
$ kill -CONT xxxx # waitpid does not raise EINTR
```
I want a way or an option to get EINTR error on sending signal so that I can release blocking of waitpid.
It is same for wait, waitpid2, wait2, too.
--
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>