0

I'm running Spacemacs and have eshell enabled. I want to run the elixir tests every time I change any files in the directory.

This is the command I'm running

ls * | entr elixir bob_test.exs 

This runs perfects through external terminal but when in eshell it returns with this output

release: 4.1
usage: entr [-cdnprs] utility [argument [/_] ...] < filenames

What is the issue? I'm using the fish shell.

  • 2
    eshell is a shell separate from the one you're using in your terminal. You might want to try using shell or term in Emacs to get access to fish. – DoMiNeLa10 Jan 6 at 11:12
1

Eshell is an Elisp based shell. Most details of that shell are described in the Emacs User Manual. Also the page Mastering Eshell gives good advice about the Eshell.

Eshell supports globbing and pipes. So your command ls * | entr elixir bob_test.exs works with slight modifications.

  1. Eshell does not use pipes for process communication by default but pty. It looks like entr needs a pipe. You can force a pipe for entr by adding entr to the list eshell-needs-pipe:
(eval-after-load "esh-proc" '(add-to-list 'eshell-needs-pipe "entr"))
  1. You call the Elisp implementation of ls when you use ls directly. The Elisp version handles the globber * slightly different than /usr/bin/ls. It prints also subdirectories and their content.

    Prepend a star * to your command or give the full path to the command if you want to enforce the external version of the command.

    The following line should work in Eshell:

*ls * | *entr elixir bob_test.exs

Note that I also added a star to entr to avoid all potential clashes with Elisp internal stuff.

  • Still the same issue – Aswin Mohan Jan 8 at 12:21
  • @AswinMohan Please add "entr" to the list eshell-needs-pipe as I have added it as item 1 to my answer and try again. – Tobias Jan 8 at 22:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.