unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* `interrupt-process` doesn't work for Python on Windows
@ 2022-02-09  9:17 Joost
  2022-02-10 13:01 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Joost @ 2022-02-09  9:17 UTC (permalink / raw)
  To: emacs-devel

Hi,

After running into an issue with a package that enhances Emacs' inferior Python shell and a long back and forth with the package's maintainer, the maintainer feels there might be a bug in Emacs. Specifically, the command `interrupt-process` is not able to interrupt the Python process on Windows. Details are in this message and in the message's thread:

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?

TIA

Joost


-- 
Joost Kremers
Life has its moments



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: `interrupt-process` doesn't work for Python on Windows
  2022-02-09  9:17 `interrupt-process` doesn't work for Python on Windows Joost
@ 2022-02-10 13:01 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2022-02-10 13:01 UTC (permalink / raw)
  To: Joost; +Cc: emacs-devel

> Date: Wed, 09 Feb 2022 10:17:33 +0100
> From: Joost <joostkremers@fastmail.fm>
> 
> 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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-10 13:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-09  9:17 `interrupt-process` doesn't work for Python on Windows Joost
2022-02-10 13:01 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).