Subject: bug#71853: 29.4; `kill-compilation` does not kill compilation process on Windows

From: Tze Chian Kam <[email-masked]>
Date: Mon, 1 Jul 2024 12:53:51 +1000

> From: Eli Zaretskii
> Date: Sun, 30 Jun 2024 20:53:34 +0300
>
> > From: Tze Chian Kam <[email-masked]>
> > Date: Mon, 1 Jul 2024 01:58:30 +1000
> >
> > > From: Eli Zaretskii
> > > Date: Sun, 30 Jun 2024 12:07:06 +0300
> > > Please show the exact file you used as the compilation command,
> > > because I cannot reproduce this with a few programs I tried, see
> > > below.
> >
> > Sorry, I used a Python file:
> > ```
> > import time
> >
> > while True:
> >     print("active")
> >     sleep(1)
> > ```
>
> And how exactly did you invoke this?  Please show the complete
> command you typed at the prompt of "M-x compile", because trying
> to reproduce this (see below) I could't.

I did "M-x compile RET python loop.py RET". Also, when running this
program, it does not output anything in the *compilation* buffer ("active"
is not printed every second).

> Also, can you interrupt the same program if you run it from the
> Windows command prompt window and then type Ctrl-C?

Yes.

> I tried to run this program (without knowing how exactly did you do
> that).  Here's what I did:
>
>   . saved this program to a file loop.py
>   . in "emacs -Q" typed the Emacs command
>
>      M-x compile RET python loop.py RET
>
> I then got an error:
>
>    python loop.py
>    active
>    Traceback (most recent call last):
>      File "loop.py", line 5, in <module>
>        sleep(1)
>    NameError: name 'sleep' is not defined
>
>    Compilation exited abnormally with code 1 at Sun Jun 30
> 20:47:35, duration 0.12 s

Sorry for the wrong program.

On Mon, 1 Jul 2024 at 03:53, Eli Zaretskii <[email-masked]> wrote:
>
> [Please use Reply All to reply, to keep the bug tracker CC'ed.]
>
> > From: Tze Chian Kam <[email-masked]>
> > Date: Mon, 1 Jul 2024 01:58:30 +1000
> >
> > > From: Eli Zaretskii
> > > Date: Sun, 30 Jun 2024 12:07:06 +0300
> > > Please show the exact file you used as the compilation command,
> > > because I cannot reproduce this with a few programs I tried, see
> > > below.
> >
> > Sorry, I used a Python file:
> > ```
> > import time
> >
> > while True:
> >     print("active")
> >     sleep(1)
> > ```
>
> And how exactly did you invoke this?  Please show the complete command
> you typed at the prompt of "M-x compile", because trying to reproduce
> this (see below) I could't.
>
> Also, can you interrupt the same program if you run it from the
> Windows command prompt window and then type Ctrl-C?
>
> I tried to run this program (without knowing how exactly did you do
> that).  Here's what I did:
>
>   . saved this program to a file loop.py
>   . in "emacs -Q" typed the Emacs command
>
>      M-x compile RET python loop.py RET
>
> I then got an error:
>
>    python loop.py
>    active
>    Traceback (most recent call last):
>      File "loop.py", line 5, in <module>
>        sleep(1)
>    NameError: name 'sleep' is not defined
>
>    Compilation exited abnormally with code 1 at Sun Jun 30 20:47:35, duration 0.12 s
>
> I then modified the program as follows:
>
>     import time
>
>     while True:
>         print("active")
>         time.sleep(1)
>
> and ran the same compilation command again, then typed C-c C-k into
> the compilation buffer.  The result:
>
>    python loop.py
>    active
>    active
>    active
>    active
>    active
>    Traceback (most recent call last):
>      File "loop.py", line 5, in <module>
>        time.sleep(1)
>    KeyboardInterrupt
>
>    Compilation interrupt at Sun Jun 30 20:49:10, duration 4.37 s
>
> which is what I would expect.
>
> My Python is version 3.4.4, for native MS-Windows, installed from
> python.org.
>
> So bottom line: it works for me, even with your test program.  I'm
> puzzled why it doesn't work for you.