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: Miles Bader
Subject: Re: Doing Linux admin work with Emacs
Date: Wed, 08 Dec 2010 15:32:07 -0000

Barry Margolin <barmar@alum.mit.edu> writes:
>> 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?

Well, both compile-time settings and run-time settings.

Of course, the handling of ptys/ioctls/etc is very system-dependent,
and there's tons of different compile-time-selected code-paths in
Emacs to handle them on different types of systems -- but configure
should get that right mostly.

At runtime, the only configuration I'm aware of is whether pipes or
ptys are used for subprocesses (via the `process-connection-type'
variable, defaulting to t [ptys] on most non-Windows systems I think).
If Emacs uses pipes for subshells, things generally work less nicely.

> 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).

On linux, at least, Emacs just sends the appropriate interrupt character
to the pty master as if the user had typed it.

So if the user types "C-c C-c" in a shell buffer, comint calls
(interrupt-process ...), which in process.c gets turned into
process_send_signal (..., SIGINT, ...) -- but then process_send_signal
notices it's a pty and SIGINT, and turns around and just sends "^C" to
the pty as input!

This isn't pretty, and has problems of its own, but it does generally
handle the "interrupting a sudo'd command in a shell buffer" case as
users expect.

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

Dunno if it's broken on 22.x (haven't used that for ages), but I
have the vague impression that things have basically behaved the
same way for a long time...

-Miles

-- 
Youth, n. The Period of Possibility, when Archimedes finds a fulcrum,
Cassandra has a following and seven cities compete for the honor of endowing a
living Homer.


reply via email to

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