1

In Emacs, the features shell, term, and eshell are different commands used for similar goals.

When executed, shell and term create active processes in Emacs. I expected the same for eshell. However, eshell does not create an active process in Emacs.

Where does this behaviour come from?

Try starting emacs without the init file and executing each of the three commands in separate sessions. Then, try to quit emacs by executing the command named save-buffers-kill-terminal (default binding is C-x C-c).

When doing this test with term and shell, Emacs prompts the user with:

Active processes exist; kill them and exit anyway? (yes or no)

While the same recipe on eshell does not trigger the same question. It is simply possible to directly quit Emacs.

Why is the treatment different? Why does eshell not create an active process in Emacs? Is there any architectural explanation?

1 Answer 1

4

As mentioned in the manual page on Processes, the term process refers to an OS process. Emacs runs in a process, but can invoke other external processes and manage them as subprocesses. When you run M-x shell or M-x term, it executes a shell (e.g. bash), which is a program external to Emacs (e.g. /bin/bash), so it must run as a subprocess.

Eshell is implemented entirely in Emacs Lisp, and therefore does not require starting a subprocess, as noted in the manual:

[Eshell] invokes no external processes except for those requested by the user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.