purcell / exec-path-from-shell

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

Improper handling of shell paths with spaces #113

Open 8bitter opened 1 year ago

8bitter commented 1 year ago

This happens on Windows, but I suspect it would happen on any platform with a space in the path.

Error from Emacs 28.2:

Error (use-package): exec-path-from-shell/:init: Non-zero exit code from shell C:\Program Files\Git\usr\bin\bash.exe invoked with args ("-l" "-i" "-c" "c:/Program Files/Git/usr/bin/printf.exe '__RESULT\\000%s\\000%s\\000__RESULT' \"${PATH-d932e0941975cd140d6dd7a8f88c8420}\" \"${MANPATH-d932e0941975cd140d6dd7a8f88c8420}\"").  Output was:
"bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
bash: c:/Program: No such file or directory

Command prompt 'where' command:

C:\>where bash
C:\Windows\System32\bash.exe
C:\Program Files\Git\usr\bin\bash.exe
purcell commented 1 year ago

Actually, it would not happen on other platforms. The path of the shell is passed as a distinct argument to call-process, so on most platforms it can safely include spaces. I seem to recall (from other packages) that certain combinations of windows and bash exhibit this issue, though — it's the first time I've seen it reported here. It might depend on the type of installation of bash, but I can't really advise how best to address it.