From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: Doing Linux admin work with Emacs Date: Thu, 14 Oct 2010 21:50:17 -0400 Organization: A noiseless patient Spider Message-ID: References: <70fd06bf-4566-4274-9381-ee569700cabd@n40g2000vbb.googlegroups.com> <8762x6jnde.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1291883462 30201 80.91.229.12 (9 Dec 2010 08:31:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Dec 2010 08:31:02 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 09 09:30:57 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PQbtr-0004Ur-8X for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 09:30:51 +0100 Original-Received: from localhost ([127.0.0.1]:48037 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQbtq-0007V8-2s for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 03:30:50 -0500 Original-Path: usenet.stanford.edu!newsserver.news.garr.it!kanaga.switch.ch!switch.ch!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 57 Injection-Date: Fri, 15 Oct 2010 01:50:18 +0000 (UTC) Injection-Info: barmar.motzarella.org; posting-host="+bxBiZT/p0ZLLuDb5H+JCw"; logging-data="31891"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/51Ji2bnTJXXmTFC71b/VY" User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Cancel-Lock: sha1:5b5URkld2QtWBgTAAp3BiOCyvzo= Original-Xref: usenet.stanford.edu gnu.emacs.help:181786 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:76874 Archived-At: In article , Miles Bader wrote: > Barry Margolin 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 ***