remote-sync
remote-sync copied to clipboard
Diff operation fails
On Windows 8, using 'diff' for difftoolCommand value, diff operation fails. Note that when pasting the exact command that is output to the Atom console into a command prompt, it works as expected. In other words, this works from the command line:
diff C:\Users\Joe\path\to\file.php C:\Users\Joe\AppData\Local\Temp\remote-sync\path\to\file.php
...but fails from within Atom. The full error report from the console:
Check [difftool Command] in your settings (remote-sync). Command error: Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c ""diff" "C:\Users\Joe\path\to\file.php" "C:\Users\Joe\AppData\Local\Temp\remote-sync\path\to\file.php"" command: diff C:\Users\Joe\path\to\file.php C:\Users\Joe\AppData\Local\Temp\remote-sync\path\to\file.php
On Linux it also fails.
Check [difftool Command] in your settings (remote-sync). Command error: Error: Command failed: /bin/sh -c "/usr/bin/diff" "/path/to/file" "/tmp/path/to/file" command: /usr/bin/diff /path/to/file /tmp/path/to/file
OS: Linux Mint 17.2 Rafaela (based on Ubuntu 14.04.2 LTS) remote-sync version: 3.1.2 Atom version: 1.0.2
@jegra Have you try config diff command of full path?
@ffflorian Did you check /usr/bin/diff exist?
@yongkangchen
Yes, it exists:
$ /usr/bin/diff --version
diff (GNU diffutils) 3.3
Copyright © 2013 Free Software Foundation, Inc.
Also fails on OS X and /usr/bin/diff does exist.
For Windows it seems to add a double-quote before the command which breaks it.
Remote Sync Settings > Diff tool command "C:\Program Files (x86)\IDM Computer Solutions\UltraCompare\uc.exe" -p Command failed: C:\Windows\system32\cmd.exe /s /c """C:\Program Files (x86)\IDM Computer Solutions\UltraCompare\uc.exe" -p" "C:\Users\Johan\Documents\Projects\confinder\python2\web.py" "C:\Users\Johan\AppData\Local\Temp\remote-sync\web.py"" '""C:\Program' is not recognized as an internal or external command, operable program or batch file.
The problem there being that the diff tool command gets wrapped with double-quotes ""C:\Program Files (x86)\IDM Computer Solutions\UltraCompare\uc.exe" -p"
Changing the Diff tool command to C:\Program Files (x86)\IDM Computer Solutions\UltraCompare\uc.exe" -p (Removing the leading double-quote) Makes it execute without any problems.
For mac also it seems double-quote breaks it.
Removing the double quotes for me didn't fix it however...
I have the same problem on MacOS too ... Anyone managed to get it fixed?
I managed to get around the error. The problem is the "return if not err" below the exec. The standard "diff" uses errorcode=1 when there are changes.
I changed the line to:
return if err.code==1 || err.code==0
but then simply nothing happends ... so there is no code that do something with the result of the diff result :-( ...
I ran into this issue as well, and it appears to be a documentation problem.
The diff option is designed to launch a diff "tool", i.e. a graphical program that helps visualize and review diffs (which typically does not return a nonzero exit code)
/usr/bin/diff, however, is text-based. Even if remote-sync were able to run it correctly, it has no provisions for displaying the output in a reasonable way.
On Mac, diff tools include opendiff (which comes with XCode) and meld (an open-source program that one can install)
It would be helpful if the remote-sync documentation explicitly mentioned that it expects a graphical program, not a path to the diff executable.
See my diff tool command explanation https://github.com/yongkangchen/remote-sync/pull/375
This might help Mac users. I used these instructions for p4merge.app Just made the file executable and saved to Documents folder Diff tool command: /Users/MYUSERNAME/documents/mymerge.sh
https://community.perforce.com/s/article/2848