From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: `interrupt-process` doesn't work for Python on Windows Date: Thu, 10 Feb 2022 15:01:02 +0200 Message-ID: <83h796ub8x.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4507"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Joost Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 10 16:28:37 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nIBN6-0000yR-Nj for ged-emacs-devel@m.gmane-mx.org; Thu, 10 Feb 2022 16:28:36 +0100 Original-Received: from localhost ([::1]:51976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nIBN5-000649-5o for ged-emacs-devel@m.gmane-mx.org; Thu, 10 Feb 2022 10:28:35 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:37626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nI95E-0002EW-4J for emacs-devel@gnu.org; Thu, 10 Feb 2022 08:02:00 -0500 Original-Received: from [2001:470:142:3::e] (port=55008 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nI94g-0004QU-Dv; Thu, 10 Feb 2022 08:01:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=9V9U1BPCc2a/MzZw1xS/lV4noc6h0cc6JU+59hKwzk4=; b=bcm12ObWbnqr wDLwYvzjwjz9h+/cGYrOqZXRgHQOxjyHXBGk0wh0KQlivHSMkSoln7A6bOeqhed024YoesTGCm2Lk pAwfh6esiFnTbxROhQoGaFGw7uRckDdCqzobsmKoVPOfoErxpJbog6jT2Y6dB7XIkFmbB/CgyX0vP IlgiJEV8GJ4Xeas7LlLv2aIaUTJjqKw7QhEkZVO8mKaZVkirsasBUoxwqrESOAKfUz9jttW3QqRO9 KNWdVayM0lmDV2FrUtXuzsCpOFdPV+ZYGQ/pFnZWdwiTe4M3ZMZKl0ksXtIVf9BDEo/clpk7dztw6 S2lVLgFvPYUWcTnX407Z0Q==; Original-Received: from [87.69.77.57] (port=3803 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nI94N-0002GX-VA; Thu, 10 Feb 2022 08:01:14 -0500 In-Reply-To: (message from Joost on Wed, 09 Feb 2022 10:17:33 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:286136 Archived-At: > Date: Wed, 09 Feb 2022 10:17:33 +0100 > From: Joost > > https://github.com/jdtsmith/python-mls/issues/8#issuecomment-1033120469 > > To quote the relevant section: > > ==================== > Here is the issue: `interrupt-process` (and internal C function) does not function correctly to interrupt Python on Windows emacs! While at the command prompt, a simple `C-c` does correctly interrupt (and returns `Keyboard Interrupt\n>>> ` promptly), `interrupt-process` does not, and leads to the double-traceback you reported earlier, but _only after you send another newline_. This is incorrect behavior, and seems to represent a bug in the way Emacs sends interrupts on Windows, which differs from `C-c` in the command prompt. > > It's easy to verify the difference: > > * `C-c` at `>>> ` python prompt in "Command Prompt": immediate `KeyboardInterrupt` and prompt. > * `C-c C-c` at `>>> ` python prompt in Emacs _Python_: no `KeyboardInterrupt`. > > ==================== > > Should I file a bug report about this? Or is this something Emacs can do nothing about? As I responded there, Emacs on MS-Windows emulates SIGINT to a sub-process by injecting an actual Ctrl-C character into the sub-process's input stream. But that might not do what you expect, because Emacs on Windows communicates with sub-processes via pipes, not via (pseudo)console devices, and thus Python could react to Ctrl-C differently than it reacts when run from the console. So at least at the moment, this doesn't look like an Emacs problem.