From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 302641FB0A for ; Sat, 5 Dec 2020 12:57:27 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 6B8CB120BEE; Sat, 5 Dec 2020 21:56:41 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id F3170120BE8 for ; Sat, 5 Dec 2020 21:56:38 +0900 (JST) Received: by filterdrecv-p3las1-64dcbcd76c-9wl4s with SMTP id filterdrecv-p3las1-64dcbcd76c-9wl4s-19-5FCB83AD-D 2020-12-05 12:57:17.417018647 +0000 UTC m=+143677.484365975 Received: from herokuapp.com (unknown) by ismtpd0093p1iad2.sendgrid.net (SG) with ESMTP id kJRkeQnvSG6_8SP8wm2noQ for ; Sat, 05 Dec 2020 12:57:17.290 +0000 (UTC) Date: Sat, 05 Dec 2020 12:57:17 +0000 (UTC) From: samuel@oriontransfer.net Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 77122 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 17369 X-Redmine-Issue-Author: ioquatix X-Redmine-Issue-Assignee: ioquatix X-Redmine-Sender: ioquatix X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?cjxb6GWHefMLoR50bkJBcGo6DRiDl=2FNYcMZdY+Wj30TpYfcAEC9QdLCbKJXio0?= =?us-ascii?Q?qd07uFuvuVqu2lZDpuAbVjXu81O7QcWoPb110ru?= =?us-ascii?Q?rqNcAeQhzRh=2F2nCuDZi0xisnwpXVEnimSA1mRQS?= =?us-ascii?Q?4CrLO3y6=2FtiPn7dWFFkB+inZ5PQJR41+EUDane=2F?= =?us-ascii?Q?QkLAvfyRQjN+GjpvOE8dPPSxRraljnRZNDgOPdQ?= =?us-ascii?Q?vvIOH1aZDchaHclr8=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 101253 Subject: [ruby-core:101253] [Ruby master Bug#17369] Introduce non-blocking `Process.wait`, `Kernel.system` and related methods. X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" 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/