Eshell/Detach: Add comments.
parent
62f5f7c69a
commit
a669f6b2cb
|
@ -14,12 +14,16 @@
|
|||
;;
|
||||
;; emacs --batch --eval '(progn (eshell) (insert "echo hello") (eshell-send-input))'
|
||||
;;
|
||||
;; Issues: --batch sends to stderr. How do we redirect the output to the real stdout/stderr?
|
||||
;; 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.
|
||||
;;; 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?
|
||||
|
||||
;; TODO: Add list of regexp matches for which detach should automatically be used.
|
||||
|
||||
(defvar eshell-detach-program "dtach"
|
||||
"The `dtach' program.")
|
||||
|
||||
|
@ -58,6 +62,7 @@ The 'tee' program is required.")
|
|||
"If non-nil and a string, stdout and stderr will also be saved to file named after the socket with this extension appened.
|
||||
The 'tee' program is required.")
|
||||
|
||||
;; TODO: Turn into a defcustom, and offer `user-emacs-directory' as well.
|
||||
(defvar eshell-detach-directory (if server-socket-dir server-socket-dir temporary-file-directory)
|
||||
"The directory where to store the dtach socket and the logs.")
|
||||
|
||||
|
@ -100,6 +105,7 @@ Suitable for `eshell-detach-file-pattern-function'."
|
|||
;; { { echo stdout; echo stderr >&2; } > >(tee stdout.txt ); } 2> >(tee stderr.txt ) | tee stdout+stderr.txt
|
||||
(commandline (format "{ { %s; }%s }%s %s; for i in %s %s %s; do [ ! -s \"$i\" ] && rm -- \"$i\"; done"
|
||||
input
|
||||
;; TODO: Move `tee' to a defvar.
|
||||
(if stdout (format " > >(tee %s );" stdout) "")
|
||||
(if stderr (format " 2> >(tee %s )" stderr) "")
|
||||
(if stdout+stderr (format " | tee %s" stdout+stderr) "")
|
||||
|
@ -237,7 +243,7 @@ newline."
|
|||
;;
|
||||
;; When attaching, then dtach (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 to send signals to all children.
|
||||
;; processes the command will start so we need to send signals to all children.
|
||||
(let* ((dtach-client (process-id (eshell-interactive-process)))
|
||||
dtach-daemon
|
||||
result
|
||||
|
|
Loading…
Reference in New Issue