summaryrefslogtreecommitdiff
path: root/test/lisp/eshell/em-tramp-tests.el
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright year to 2025Paul Eggert2025-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* Use 'unwind-protect' to ensure that Eshell always closes I/O handlesJim Porter2024-07-271-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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'.
* Improve handling of deferrable Eshell commandsJim Porter2024-07-181-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | Now, we use the 'eshell-deferrable' wrapper to wrap a form that returns a process (or list thereof). This improves upon the old method, which failed to handle 'eshell-replace-command' correctly. In that case, Eshell would fail to unmark commands as deferrable when necessary (e.g. for commands in pipelines). * lisp/eshell/esh-cmd.el (eshell-deferrable-commands): Make into a defvar. (eshell-deferrable): New function... (eshell-structure-basic-command): ... use it. (eshell-trap-errors): Rename to... (eshell-do-command): ... this, and use 'eshell-deferrable'. Update callers. (eshell--unmark-deferrable): Remove. Update callers. (eshell-execute-pipeline): Remove 'eshell-process-identity'. (eshell-process-identity, eshell-named-command*, eshell-lisp-command*): Make obsolete. * test/lisp/eshell/esh-cmd-tests.el (eshell-test-replace-command): New function. (esh-cmd-test/pipeline/replace-command): New test.
* Fix command replacement with the Eshell builtin versions of "sudo" and "doas"Jim Porter2024-01-271-49/+40
| | | | | | | | | | | | | | | | This is particularly important when the inner command to execute is an alias. Aliases throw 'eshell-replace-command' too, so we want to do this in two phases: first, replace the "sudo"/"doas" with a let-binding of 'default-directory', and then later, let the alias code do its own replacement (bug#68074). * lisp/eshell/em-tramp.el (eshell/sudo, eshell/doas): Use 'eshell-replace-command' to wrap the inner command. * test/lisp/eshell/em-tramp-tests.el (mock-eshell-named-command): Remove. (em-tramp-test/sudo-basic, em-tramp-test/sudo-user) (em-tramp-test/doas-basic, em-tramp-test/doas-user): Catch 'eshell-replace-command'.
* Merge from savannah/emacs-29Po Lu2024-01-021-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dc4e6b13296 ; Update copyright years in more files 64b37776318 ; Run set-copyright from admin.el 8e1c56ae467 ; Add 2024 to copyright years # Conflicts: # doc/misc/modus-themes.org # doc/misc/texinfo.tex # etc/NEWS # etc/refcards/ru-refcard.tex # etc/themes/modus-operandi-theme.el # etc/themes/modus-themes.el # etc/themes/modus-vivendi-theme.el # lib/alloca.in.h # lib/binary-io.h # lib/c-ctype.h # lib/c-strcasecmp.c # lib/c-strncasecmp.c # lib/careadlinkat.c # lib/cloexec.c # lib/close-stream.c # lib/diffseq.h # lib/dup2.c # lib/filemode.h # lib/fpending.c # lib/fpending.h # lib/fsusage.c # lib/getgroups.c # lib/getloadavg.c # lib/gettext.h # lib/gettime.c # lib/gettimeofday.c # lib/group-member.c # lib/malloc.c # lib/md5-stream.c # lib/md5.c # lib/md5.h # lib/memmem.c # lib/memrchr.c # lib/nanosleep.c # lib/save-cwd.h # lib/sha1.c # lib/sig2str.c # lib/stdlib.in.h # lib/strtoimax.c # lib/strtol.c # lib/strtoll.c # lib/time_r.c # lib/xalloc-oversized.h # lisp/auth-source-pass.el # lisp/emacs-lisp/lisp-mnt.el # lisp/emacs-lisp/timer.el # lisp/info-look.el # lisp/jit-lock.el # lisp/loadhist.el # lisp/mail/rmail.el # lisp/net/ntlm.el # lisp/net/webjump.el # lisp/progmodes/asm-mode.el # lisp/progmodes/project.el # lisp/progmodes/sh-script.el # lisp/textmodes/flyspell.el # lisp/textmodes/reftex-toc.el # lisp/textmodes/reftex.el # lisp/textmodes/tex-mode.el # lisp/url/url-gw.el # m4/alloca.m4 # m4/clock_time.m4 # m4/d-type.m4 # m4/dirent_h.m4 # m4/dup2.m4 # m4/euidaccess.m4 # m4/fchmodat.m4 # m4/filemode.m4 # m4/fsusage.m4 # m4/getgroups.m4 # m4/getloadavg.m4 # m4/getrandom.m4 # m4/gettime.m4 # m4/gettimeofday.m4 # m4/gnulib-common.m4 # m4/group-member.m4 # m4/inttypes.m4 # m4/malloc.m4 # m4/manywarnings.m4 # m4/mempcpy.m4 # m4/memrchr.m4 # m4/mkostemp.m4 # m4/mktime.m4 # m4/nproc.m4 # m4/nstrftime.m4 # m4/pathmax.m4 # m4/pipe2.m4 # m4/pselect.m4 # m4/pthread_sigmask.m4 # m4/readlink.m4 # m4/realloc.m4 # m4/sig2str.m4 # m4/ssize_t.m4 # m4/stat-time.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/stdio_h.m4 # m4/stdlib_h.m4 # m4/stpcpy.m4 # m4/strnlen.m4 # m4/strtoimax.m4 # m4/strtoll.m4 # m4/time_h.m4 # m4/timegm.m4 # m4/timer_time.m4 # m4/timespec.m4 # m4/unistd_h.m4 # m4/warnings.m4 # nt/configure.bat # nt/preprep.c # test/lisp/register-tests.el
| * ; Add 2024 to copyright yearsPo Lu2024-01-021-1/+1
| |
* | Merge from origin/emacs-29Eli Zaretskii2023-01-011-1/+1
|\| | | | | | | | | | | | | | | | | | | | | cae528457c ; Add 2023 to copyright years. b394359261 Improve documentation of 'isearch-open-overlay-temporary' ab3210e709 Document 'use-package' in the 2 main manuals # Conflicts: # etc/refcards/ru-refcard.tex # lib/explicit_bzero.c # m4/explicit_bzero.m4
| * ; Add 2023 to copyright years.Eli Zaretskii2023-01-011-1/+1
| |
* | Fix reference-counting of Eshell I/O handlesJim Porter2022-12-291-55/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ensures that output targets in Eshell are only closed when Eshell is actually done with them. In particular, this means that "{ echo foo; echo bar } | rev" prints "raboof" as expected (bug#59545). * lisp/eshell/esh-io.el (eshell-create-handles): Structure the handles differently so the targets and their ref-count can be shared. (eshell-duplicate-handles): Reimplement this to share targets between the original and new handle sets. Add STEAL-P argument. (eshell-protect-handles, eshell-copy-output-handle) (eshell-interactive-output-p, eshell-output-object): Account for changes to the handle structure. (eshell-close-handle): New function... (eshell-close-handles, eshell-set-output-handle): ... use it. (eshell-get-targets): Remove. This only existed to make the previous implementation of 'eshell-duplicate-handles' work. * lisp/eshell/esh-cmd.el (eshell-with-copied-handles): New argument STEAL-P. (eshell-do-pipelines): Use STEAL-P for the last item in the pipeline. (eshell-parse-command): Don't copy handles for the last command in the list; explain why we can't use STEAL-P here. (eshell-eval-command): When queuing input, set 'eshell-command-body' and 'eshell-test-body' for the 'if' conditional (see 'eshell-do-eval'). * test/lisp/eshell/esh-io-tests.el (esh-io-test/redirect-pipe): Split into... (esh-io-test/pipeline/default, esh-io-test/pipeline/all): ... these. (esh-io-test/pipeline/subcommands): New test. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/for-loop-pipe) (esh-cmd-test/while-loop-pipe, esh-cmd-test/if-statement-pipe) esh-cmd-test/if-else-statement-pipe): New tests. (esh-cmd-test/while-loop): Use 'pop' to simplify the test a bit. * test/lisp/eshell/eshell-test-helpers.el (eshell-test--max-subprocess-time): Rename to... (eshell-test--max-wait-time): ... this. (eshell-wait-for): New function... (eshell-wait-for-subprocess): ... use it. * test/lisp/eshell/eshell-tests.el (eshell-test/queue-input): Fix this test. Previously, it didn't correctly verify that the original command completed. * test/lisp/eshell/em-tramp-tests.el (em-tramp-test/should-replace-command): New macro... (em-tramp-test/su-default, em-tramp-test/su-user) (em-tramp-test/su-login, em-tramp-test/sudo-shell) (em-tramp-test/sudo-user-shell, em-tramp-test/doas-shell) (em-tramp-test/doas-user-shell): ... use it.
* | Fix handling of output handles in nested Eshell formsJim Porter2022-12-221-34/+41
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the output handles in nested forms would be reset to the default, leading to wrong behavior for commands like {echo a; echo b} > file "b" would be written to "file" as expected, but "a" would go to standard output (bug#59545). * lisp/eshell/esh-cmd.el (eshell-parse-command): Use 'eshell-with-copied-handles' for each statement within the whole Eshell command. * test/lisp/eshell/esh-io-tests.el (esh-io-test/redirect-subcommands) (esh-io-test/redirect-subcommands/override) (esh-io-test/redirect-subcommands/interpolated): New tests. * test/lisp/eshell/em-script-tests.el (em-script-test/source-script/redirect) (em-script-test/source-script/redirect/dev-null): New tests. (em-script-test/source-script, em-script-test/source-script/arg-vars) (em-script-test/source-script/all-args-var): Tweak names/docstrings. * test/lisp/eshell/em-extpipe-tests.el (em-extpipe-tests--deftest): Skip over the newly-added 'eshell-with-copied-handles' form when checking the parse results. * test/lisp/eshell/em-tramp-tests.el (em-tramp-test/su-default) (em-tramp-test/su-user, em-tramp-test/su-login) (em-tramp-test/sudo-shell, em-tramp-test/sudo-user-shell) (em-tramp-test/doas-shell, em-tramp-test/doas-user-shell): Update expected command forms.
* Add the "doas" alias to eshell.Brian Cully2022-11-051-0/+75
| | | | | | | | | | | | | * lisp/eshell/em-tramp.el (eshell/doas): new function. (eshell--method-wrap-directory): new function. (eshell/sudo): accept '-s'/'--shell' for interactive use. * test/lisp/eshell/em-tramp-tests.el (em-tramp-test/sudo-shell) (em-tramp-test/sudo-user-shell) (em-tramp-test/doas-basic) (em-tramp-test/doas-user) (em-tramp-test/doas-shell) (em-tramp-test/doas-user-shell): new tests. * etc/NEWS: mention new 'doas' eshell command. * doc/misc/eshell.texi: add 'doas' command documentation.
* Adapt em-tramp-tests.elMichael Albinus2022-02-061-7/+10
| | | | | | | * test/lisp/eshell/em-tramp-tests.el (tramp): Require. (em-tramp-test/su-default, em-tramp-test/su-user) (em-tramp-test/su-login, em-tramp-test/sudo-basic) (em-tramp-test/sudo-user): Adapt tests.
* Don't manipulate args in-place for 'eshell-eval-using-options'Jim Porter2022-01-251-0/+85
This is necessary for preserve the original arguments to forward on to :external commands. Previously, when :preserve-args was also set, the original argument list could be altered, changing the meaning of the command. * lisp/eshell/esh-opt.el (eshell-eval-using-options): Copy MACRO-ARGS when :preserve-args is set, and pass the original value to 'eshell--do-opts'. (eshell--do-opts): Use the original arguments when calling an external command. * lisp/eshell/em-tramp.el (eshell/su, eshell/sudo): Don't copy the original arguments, since 'eshell-eval-using-options' does this for us. * test/lisp/eshell/esh-opt-tests.el (esh-opt-process-args-test): Split this test into... (esh-opt-test/process-args) (esh-opt-test/process-args-parse-leading-options-only) (esh-opt-test/process-args-external): ... these. (test-eshell-eval-using-options): Split this test into... (esh-opt-test/eval-using-options-short) (esh-opt-test/eval-using-options-long) (esh-opt-test/eval-using-options-constant) (esh-opt-test/eval-using-options-user-specified) (esh-opt-test/eval-using-options-short-single-token) (esh-opt-test/eval-using-options-terminate-options) (esh-opt-test/eval-using-options-parse-leading-options-only) (esh-opt-test/eval-using-options-unrecognized): ... these. (esh-opt-test/eval-using-options-external): New test. * test/lisp/eshell/em-tramp-tests.el: New tests.