Invalid argument
Apheleia gives exits with exit code 2 on Windows 11 with doom emacs:
Thu Dec 28 23:23:22 2023 :: c:/Users/hp/workspace/waiig/monkey-lang/token/
$ "diff" "--rcs" "--strip-trailing-cr" "--" "c:/Users/hp/workspace/waiig/monkey-lang/token/token.go" "-"
diff.exe: -: Invalid argument
Command succeeded with exit code 2.
Sounds like a Windows problem. If you can suggest an alternative command line syntax for diff that'll work in this environment, I could implement it.
Hi @raxod502 !
This issue is very similar to what happens to me. You will see in OpenBSD the "diff" command that comes with it does not have the "--rcs" "--strip-trailing-cr" options and therefore fails with the same error code.
One way I see to solve this issue is to create a defcustom in which we can define the correct diff binary command (in my case gdiff, from GNU Coreutils, in the case of Windows to the correct diff binary).
In this link there is an idea of how this change would be implemented.
Right, that makes sense. I'll have the default value be gdiff if available, diff otherwise. And the user can customize. On the first invocation, it will check to verify that the necessary options are supported, and report a better error if they aren't.
I get this error on Windows even when using GNU diff (installed via the scoop diffutils package):
$ diff.exe --version
diff (GNU diffutils) 3.6
I get no such error when invoking the identical command with call-process-region:
(call-process-region (point-min)
(point-max)
"diff"
nil
(get-buffer-create "test")
t
"--rcs"
"--strip-trailing-cr"
"--"
"c:/Users/josh/.emacs.d/init.el"
"-")
The above command returns a successful exit status and I can see the diff result in the test buffer.
So it's not clear to me yet why it fails for Apheleia.
I submitted a fix for my version of this problem here: https://github.com/radian-software/apheleia/pull/356