From: samuel@... Date: 2020-12-05T12:57:17+00:00 Subject: [ruby-core:101253] [Ruby master Bug#17369] Introduce non-blocking `Process.wait`, `Kernel.system` and related methods. Issue #17369 has been updated by ioquatix (Samuel Williams). > Does such code still work, with a scheduler? Yes. > It sounds like you would need a way to set $? on the current Thread. Nope, it's handled by `Process.wait` and so on. > Otherwise, just switching between Fibers (e.g., on IO) would expose the $? of other Fibers, which will lead to bugs. Agree, but we can't change this without potentially breaking existing code. Also, is it okay that `Process.last_status` and `Process.last_status=` (hypothetical) are fiber local? Because Matz already said he was against class attributes that are actually fiber local (even if I agree in theory, excluding the fact that this is a breaking change). > I expect that change to cause extremely few compatibility issues ($~, etc are already fiber-local + frame-local). Great, if Matz can approve the change, then we can implement it, but it's separate from this PR, since this PR just makes the existing interface non-blocking. ---------------------------------------- Bug #17369: Introduce non-blocking `Process.wait`, `Kernel.system` and related methods. https://bugs.ruby-lang.org/issues/17369#change-88930 * Author: ioquatix (Samuel Williams) * Status: Assigned * Priority: Normal * Assignee: ioquatix (Samuel Williams) * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- https://github.com/ruby/ruby/pull/3852 This PR introduces optional hooks to the scheduler interface for handling `Process.wait`, `Kernel.system` and other related methods (`waitpid`, `wait2`, etc). It funnels all methods through a new interface `Process::Status.wait` which is almost identical to `Process.wait` except for several key differences: - The return value is a single instance of `Process::Status`. - It does not set thread local `$?`. This is necessary for keeping the scheduler interface simple (and side effects are generally bad anyway). -- https://bugs.ruby-lang.org/ Unsubscribe: