]> git.eshelyaron.com Git - emacs.git/commit
Use 'unwind-protect' to ensure that Eshell always closes I/O handles
authorJim Porter <jporterbugs@gmail.com>
Sat, 20 Jul 2024 01:02:16 +0000 (18:02 -0700)
committerEshel Yaron <me@eshelyaron.com>
Mon, 29 Jul 2024 17:16:19 +0000 (19:16 +0200)
commitb2fa22423a09a97c894a39ace99d6d9d28d98179
treeadc14d65227874a842a83b5e869c5691a3f76100
parentbbde2db75098693646a6806573b76649a124d62b
Use 'unwind-protect' to ensure that Eshell always closes I/O handles

See bug#72220.

* lisp/eshell/esh-cmd.el (eshell-with-handles): New macro...
(eshell-commands): ... use it.
(eshell-with-copied-handles): Remove STEAL-P and allow multiple body
forms (this is an incompatible change, but the macro is currently
internal despite the name).
(eshell-parse-command, eshell-do-pipelines)
(eshell-do-pipelines-synchronously, eshell--invoke-command-directly-p):
Remove handle stealing.
(eshell-structure-basic-command, eshell-do-command)
(eshell-lisp-command): Remove 'eshell-close-handles'.
(eshell-protect): Make obsolete.
(eshell-rewrite-for-command, eshell-rewrite-while-command)
(eshell-rewrite-if-command, (eshell-parse-pipeline): Remove
'eshell-protect'.

* lisp/eshell/esh-io.el (eshell-duplicate-handles): Make STEAL-P
obsolete.

* lisp/eshell/esh-proc.el (eshell-gather-process-output): Call
'eshell-protect-handles' one more time.  Remove 'eshell-close-handles'.

* lisp/eshell/esh-var.el (eshell-parse-variable-ref): Reimplement
$<COMMAND> form using 'eshell-with-handles'.

* test/lisp/eshell/esh-cmd-tests.el
(esh-cmd-test/command-not-found/pipeline): New test.

* test/lisp/eshell/em-tramp-tests.el
(em-tramp-test/should-replace-command): Adjust check for
'eshell-with-copied-handles'.

(cherry picked from commit 50339b38fdef31982744bdb8b51838012dd4ef47)
lisp/eshell/esh-cmd.el
lisp/eshell/esh-io.el
lisp/eshell/esh-proc.el
lisp/eshell/esh-var.el
test/lisp/eshell/em-tramp-tests.el
test/lisp/eshell/esh-cmd-tests.el