bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7225: 23.2.50; [PATCH] C-c C-c doesn't work in shell mode (Cygwin)


From: Ken Brown
Subject: bug#7225: 23.2.50; [PATCH] C-c C-c doesn't work in shell mode (Cygwin)
Date: Sun, 17 Oct 2010 17:40:39 -0400
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4

On 10/16/2010 9:26 AM, Eli Zaretskii wrote:
Date: Sat, 16 Oct 2010 08:44:28 -0400
From: Ken Brown<address@hidden>
CC: "address@hidden"<address@hidden>

C-c C-c
(The cat process doesn't get killed.)

Is the reason for this known?  It looks like the `kill' syscall isn't
doing its job, but if that's so, there should be a good reason for
that.

The problem is the group id in the call to 'kill'.  Cygwin doesn't
define TIOCGPGRP, and the group id as set in line 6233 of process.c
(emacs-23 branch) is the wrong group id.

Does Cygwin have another way of getting the process group ID?  If so,
can it be used in process_send_signal instead of emacs_get_tty_pgrp?
[...]
So I suggest to look into tweaking process_send_signal so that it
works with Cygwin.  It looks like it makes all kinds of assumptions
regarding systems that don't have TIOCGPGRP, and they are probably
wrong for Cyugwin.  Or maybe you need something special in
EMACS_KILLPG.

When you have fixed process_send_signal, you can then introduce
SIGNALS_VIA_CHARACTERS for Cygwin.

I haven't yet found an alternative to TIOCGPGRP that works for Cygwin, and it may well be that there isn't one. But I think there's a separate issue that is not specific to Cygwin. It seems to me that line 6233 of process.c is simply wrong, and not just for Cygwin.

When we reach that line, we want the process group ID of the foreground process group of the terminal associated with p (which is a shell in the most common use case). We don't have TIOCGPGRP, so we don't know how to do this. We therefore give up and set gid = p->pid. Is there any situation in which this is the right thing to do? It means that (in the common use case) we'll send the signal to the shell instead of to the process running in the shell. Wouldn't it be better to just return at that point and issue a warning message saying that we can't send the signal?

What this would mean for Cygwin, once I make the change I proposed (and assuming I don't find a better solution), is that the only signals we'll be able to send to the foreground process of a shell are SIGINT, SIGQUIT, and SIGTSTP, and we'll see a failure message if we try to send a different signal. That's better than sending a signal to the wrong process.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]