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

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

Re: Doing Linux admin work with Emacs


From: Barry Margolin
Subject: Re: Doing Linux admin work with Emacs
Date: Wed, 08 Dec 2010 15:31:56 -0000
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <buohbgpaxjq.fsf@dhlpc061.dev.necel.com>,
 Miles Bader <miles@gnu.org> wrote:

> Barry Margolin <barmar@alum.mit.edu> writes:
> >> There's one problem when launching a command with sudo in M-x shell: you
> >> cannot kill it with emacs C-c C-c, since emacs runs as a normal user, it
> >> cannot kill the sudo'ed process.
> >
> > You can kill it by typing C-q C-c RET.  This sends a literal C-c to the 
> > shell's terminal, instead of Emacs sending a signal to the process.
> 
> Hmm, by if Emacs was configured correctly, "C-c C-c" should handle this

What do you mean by "configured correctly"?  Is this an option the user 
can configure?  Or are you referring to a compile-time setting?

> case properly though -- it uses (interrupt-subprocess nil t):
> 
>    (interrupt-process &optional PROCESS CURRENT-GROUP)
> 
>    Interrupt process PROCESS.
>    PROCESS may be a process, a buffer, or the name of a process or buffer.
>    No arg or nil means current buffer's process.
>    Second arg CURRENT-GROUP non-nil means send signal to
>    the current process-group of the process's controlling terminal
>    rather than to the process's own process group.
>    If the process is a shell, this means interrupt current subjob
>    rather than the shell.
> 
> ... which basically interrupts the "terminal" (pty) rather than the
> process itself.

Where does it say that?  It repeatedly says that it sends the signal to 
a process or process group, it never says anything about sending a 
signal to the pty.  But ordinary users aren't allowed to send signals to 
processes owned by other users.  Typing C-c gets around this, because 
the terminal driver interprets this, and it's able to send signals to 
any process connected to the terminal (since it's in the kernel, it 
could actually send signals to any process, but it never would).

If there were an ioctl on the master side of a pty that sends a signal 
to the process group connected to the slave side, that would solve the 
problem.  But I checked my pty(4) man page and didn't see anything like 
this.

> Also, it Works For Me :)

It's never worked for me with sudo processes.

I'm running the Carbon Emacs build of Emacs 22.2, but I had the same 
problem years ago on Solaris.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


reply via email to

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