purcell / exec-path-from-shell

Make Emacs use the $PATH set up by the user's shell
Other
1.41k stars 81 forks source link

Error on Windows #39

Closed bbatsov closed 8 years ago

bbatsov commented 8 years ago

I'm not sure how to best handle this, but when on Windows you'd get something like:

Error (use-package): exec-path-from-shell :config: Non-zero exit code from shell C:/Users/bozhi/emacs-24.5/libexec/emacs/24.5/i686-pc-mingw32/cmdproxy.exe invoked with args ("-l" "-i" "-c" "printf '__RESULT\\000%s\\000%s' \"${PATH-f0e5ce552c1531f4ab5b890d638405b1}\" \"${MANPATH-f0e5ce552c1531f4ab5b890d638405b1}\"").  Output was:
"'printf' is not recognized as an internal or external command,
operable program or batch file.
"

I can disable the package in my config, or can behave differently in such cases (which seems like a better idea in general).

purcell commented 8 years ago

What is $SHELL on that machine? I don't expect to be able to support any platform without the POSIX command line programs, which is why the README suggests initialization code like:

(when (memq window-system '(mac ns))
  (exec-path-from-shell-initialize))
bbatsov commented 8 years ago
(getenv "SHELL")
"C:/Users/bozhi/emacs-24.5/libexec/emacs/24.5/i686-pc-mingw32/cmdproxy.exe"

Yeah, I get what you're saying, but it seems to me something that can be done automatically - Windows users are going to have this by default, so there can be a check for it. Btw, I thought the package was also useful on Linux, but I might be mistaken...

bbatsov commented 8 years ago

Btw, isn't it more sensible to check if system-type is darwin?

purcell commented 8 years ago

Yeah, I get what you're saying, but it seems to me something that can be done automatically - Windows users are going to have this by default, so there can be a check for it. Btw, I thought the package was also useful on Linux, but I might be mistaken...

The package is useful in some Linux configs, most OS X configs, and some Windows systems, e.g. those with ported UNIX utilities. Only the user can determine whether exec-path-from-shell is desirable on his/her system: there's no automatic rule to determine this, hence the suggested setup code.

I'd rather not start trying to handle every possible situation, or programming defensively for all the different ways things could go wrong when the package is used on unintended systems: it's enough for me that there's an error. That said, I might consider adding a check for explicitly unsupported shells, so that the error message could be more direct.

Btw, isn't it more sensible to check if system-type is darwin?

No, because if you start Emacs in a terminal on a Mac, you won't want to use exec-path-from-shell.

bbatsov commented 8 years ago

Fair enough, I'll close this.

purcell commented 8 years ago

Cheers. Noted this in the README in c2ca275. Thanks for bringing this up!