bard / emacs-run-command

Efficient and ergonomic external command invocation for Emacs
https://bard.github.io/emacs-run-command
GNU General Public License v3.0
102 stars 8 forks source link

commands aren't run in TRAMP if runner is term #24

Open p2d0 opened 1 year ago

p2d0 commented 1 year ago

image should do image but instead i get image pinned package at 22844ae959ec for now

bard commented 1 year ago

Thanks for the report, @p2d0 ! That commit looks unrelated and thus probably anterior to the one that introduced the difference. If you can bisect the issue down to the actual commit, I'm happy to look into this.

p2d0 commented 1 year ago

84520fe738f337607153b9cd37def2e4004eb3f6 seems to be the problem, default runner changed to term and it doesn't work with it Works on the latest commit with (setq run-command-default-runner 'run-command-runner-compile) Except after e9420f1527dff8a65aeb36f8c0605ce8ad7cfb04 it spawns an extra window image and after db6e67bdbe216ef158786806aaceba1001d188fe it's a blank window image and after 477c42acce9e36ec59d18deaa73992f94faf7b99 it's a popup image

bard commented 1 year ago

84520fe seems to be the problem, default runner changed to term and it doesn't work with it

Strange, I'm using the term runner daily without issues. Does this happen also with basic examples like https://bard.github.io/emacs-run-command/quickstart#your-first-recipe or only with the dir-locals recipe? Do you have one I could run on my side to try and reproduce this?

p2d0 commented 1 year ago

here's a basic example that works with compile runner but doesn't with term

  1. start a docker container
    docker run --name example1 -d busybox sh -c "while true; do echo Hello World; sleep 1; done"
(defun docker-example-recipe ()
    (list
        (list :command-name "pwd inside docker container"
            ;; should return /
            ;; but returns my home folder with term
            :command-line "pwd"
            :working-dir "/docker:example1:/"
            )
        )
    )

With compilation runner image With term image

p2d0 commented 1 year ago

eat also works image vterm doesn't (in this particular case) image

bard commented 1 year ago

Thanks @p2d0 for the repro, this helped a lot in understanding the problem.

It turns out that https://github.com/bard/emacs-run-command/commit/22844ae959ec66f609104d160a1a4e6bafa7af29 also didn't work when the runner was set to term, so this is a limitation exposed by change in defaults rather than a regression.

This is probably related to running a command via TRAMP. compilation-mode, being more Emacs-aware, probably does that correctly, while term-mode doesn't.

Unfortunately I cannot at the moment dive into TRAMP to see if this could be made to work for term-mode. I suggest you either (setq run-command-default-runner run-command-runner-compile) if you're happy with running all commands in compilation-mode, or you keep the default and set the runner on a per-recipe basis, e.g.:

  (defun docker-example-recipe ()
    (list
     (list
      :command-name "pwd inside docker container"
      :command-line "pwd"
      :working-dir "/docker:example1:/"
      :runner 'run-command-runner-compile)))
p2d0 commented 1 year ago

You're welcome! I'm delighted that I could be of help. In the end, I opted for (setq run-command-default-runner 'run-command-runner-eat) and it's working seamlessly on the master branch.

stale[bot] commented 7 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.