Issue #12693 has been updated by Shyouhei Urabe.


Naotoshi Seo wrote:
> However, ruby implementation of Process.waitpid does not raise EINTR

No you don't.  It is an extremely bad idea to use signal to interrupt execution.

Is it you must use signal for some reason or you just want to avoid infinite blocking?  What if, for instance waitpid would take extra argument as timeout?

----------------------------------------
Feature #12693: Want a way to receive EINTR on Process.waitpid
https://bugs.ruby-lang.org/issues/12693#change-60239

* 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>