Error when running on WIndows 10, GNU Emacs 25.1.1
baerrach opened this issue · 1 comments
prettier-js doesn't report any error because it doesn't check for the return value of call-process-region
on the diff
command at line 189 like it does for the call-process on the prettier-js-command
at line 185.
The error message is in the *Messages*
buffer
Error: (file-error "Searching for program" "No such file or directory" "diff")
On Windows "diff" is not installed by default. I wonder if there is an elisp function that you could call instead to make it more cross platform?
I've kind of hacked it by adding C:\Program Files\Git\usr\bin\
to the PATH
, but causes ^M
s to appear in the output file.
Which hilarously you can't remove as they come back on each save :)
After investigating the cause is diff, as it will be using dos line endings.
Adding --strip-trailing-cr
to the diff options fixes the problem.
Thanks from future me, past me.
But Git for Windows no longer includes diff.
Had to install http://gnuwin32.sourceforge.net/packages/diffutils.htm and add it to the Windows PATH, then everything worked fine.