Eshell/Detach: Comment and fix typos.

master
Pierre Neidhardt 2019-12-06 15:47:17 +01:00
parent 24ecc66c99
commit 28677e8be6
1 changed files with 8 additions and 6 deletions

View File

@ -4,8 +4,8 @@
;; dtach allows the user to disconnect (quit Eshell or even Emacs) while the command keeps going.
;; Stderr and stdout can be both displayed on screen and redirected to a file thanks to the `tee' program.
;;
;; dtach allows the commandline (that is, bash) to run in the background.
;; bash allows for:
;; dtach allows the command line processor (that is, Bash) to run in the background.
;; Bash allows for:
;; - using `tee' to separate stdout/stderr, output both in files and on screen;
;; - executing pipe lines (e.g. grep foo | sed ... | cut | wc). dtach cannot do that alone.
;;
@ -15,10 +15,11 @@
;; emacs --batch --eval '(progn (eshell) (insert "echo hello") (eshell-send-input))'
;;
;; Issues: Eshell mixes stdout and stderr. (--batch sends to stderr.) How do we redirect the output to the real stdout/stderr?
;; TODO: Support Eshell nonetheless?
;; TODO: Move eshell to a lower level of abstraction. This package should be called "detach.el".
;; TODO: Remove bash / tee / dtach dependencies? I don't think dtach can be removed.
;;; TODO: Remove bash / tee / dtach dependencies? I don't think dtach can be removed.
;;; See if `make-process' is the way to go: it supports stderr/stdout separation and stop/cont.
;;; Re-use `eshell-gather-process-output'? Re-implement?
@ -91,6 +92,7 @@ Suitable for `eshell-detach-file-pattern-function'."
(let* (
;; TODO: temp-file should not exist for dtach to start? That forces us
;; to use make-temp-file which is vulnerable to race condition.
;; TODO: Read `input' safely. E.g. from a file.
(socket (make-temp-name
(expand-file-name
(concat "dtach" (funcall eshell-detach-file-pattern-function input))
@ -225,8 +227,8 @@ newline."
;; Bash is one way:
;; (local-set-key (kbd "C-z") 'self-insert-command)
;; Pressing self-inserted "C-z RET" works.
;; That only works for interactive shells, not with `bash -c'.
;;; esh-proc.el has `eshell-stop-process' but that's not seem to work. Maybe it
;; This only works for interactive shells, not with `bash -c'.
;;; esh-proc.el has `eshell-stop-process' but this does not seem to work. Maybe it
;;; does not propagate properly.
;; TODO: Order by deepest child first so that we kill in order? Not sure it matters.
@ -241,7 +243,7 @@ newline."
;; - bash (tee of stdout)
;; - bash (tee of stderr)
;;
;; When attaching, then dtach (client) is no longer the parent of the daemon.
;; When attached to, dtach (the client) is no longer the parent of the daemon.
;; We want to send a signal to "bash (process)". We cannot predict how many
;; processes the command will start so we need to send signals to all children.
(let* ((dtach-client (process-id (eshell-interactive-process)))