all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Barry Margolin <barmar@alum.mit.edu>
To: help-gnu-emacs@gnu.org
Subject: Re: Doing Linux admin work with Emacs
Date: Thu, 14 Oct 2010 21:50:17 -0400	[thread overview]
Message-ID: <barmar-41A375.21501714102010@news.eternal-september.org> (raw)
In-Reply-To: buohbgpaxjq.fsf@dhlpc061.dev.necel.com

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 ***


  parent reply	other threads:[~2010-10-15  1:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <70fd06bf-4566-4274-9381-ee569700cabd@n40g2000vbb.googlegroups.com>
2010-10-13 12:12 ` Doing Linux admin work with Emacs Richard Riley
2010-10-13 12:19 ` Pascal J. Bourguignon
2010-10-14  2:34   ` Barry Margolin
2010-10-14  8:17     ` Olivier Sirven
2010-10-14 10:17     ` Miles Bader
2010-10-14 12:46       ` bebop52
2010-10-14 15:00         ` Pascal J. Bourguignon
2010-10-14 21:42         ` Tim X
2010-10-15  1:50       ` Barry Margolin [this message]
2010-10-16  3:16         ` Miles Bader
2010-10-13 21:20 ` Tim X

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=barmar-41A375.21501714102010@news.eternal-september.org \
    --to=barmar@alum.mit.edu \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.