emacs-run-command icon indicating copy to clipboard operation
emacs-run-command copied to clipboard

commands aren't run in TRAMP if runner is term

Open p2d0 opened this issue 2 years ago • 8 comments

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

p2d0 avatar Oct 09 '23 14:10 p2d0

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.

bard avatar Oct 09 '23 16:10 bard

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

p2d0 avatar Oct 10 '23 15:10 p2d0

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?

bard avatar Oct 10 '23 17:10 bard

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 avatar Oct 10 '23 20:10 p2d0

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

p2d0 avatar Oct 10 '23 21:10 p2d0

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)))

bard avatar Oct 13 '23 09:10 bard

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.

p2d0 avatar Oct 13 '23 14:10 p2d0

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

stale[bot] avatar Mar 13 '24 05:03 stale[bot]