I'm trying to find a way to run .rb files that are in the $PATH in Eshell by following the solution here. I added ".rb" to exec-suffixes, set eshell-force-execution to t and customized eshell-interpreter-alist like this:

Regexp: \.rb
String: c:/programs/rails/Ruby1.9.3/bin/ruby.exe

But when I run an .rb file in eshell I get an error: c:\programs\rails\Ruby1.9.3\bin\ruby.exe: No such file or directory -- bill.rb (LoadError)

However it works if I run the file in the directory where it is located or with a full path. Seems like it is necessary to make interpreter in eshell-interpreter-alist expand bill.rb to its full path somehow to make it work, but I couldn't find a way to do that.

  • Are you 100% sure it exists in your $PATH? M-x getenv PATH
    – Steven
    Jun 6 '16 at 20:34
  • which returns the full path to the file. Your suggestion reveals no errors either.
    – Sum Proxy
    Jun 7 '16 at 5:46

I had to change eshell-interpreter-alist to Regexp: \.rb Interpreter: eshell-run-ruby-command-from-path And provide the following function to make it work (defun eshell-run-ruby-command-from-path (args) (eshell-named-command "ruby.exe" (list (eshell-search-path args))))

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.