Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diff operation fails #164

Open
jegra opened this issue Jun 21, 2015 · 12 comments
Open

Diff operation fails #164

jegra opened this issue Jun 21, 2015 · 12 comments
Labels

Comments

@jegra
Copy link

jegra commented Jun 21, 2015

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

@ffflorian
Copy link

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

@yongkangchen
Copy link
Owner

@jegra Have you try config diff command of full path?
@ffflorian Did you check /usr/bin/diff exist?

@ffflorian
Copy link

@yongkangchen

Yes, it exists:

$ /usr/bin/diff --version
diff (GNU diffutils) 3.3
Copyright © 2013 Free Software Foundation, Inc.

@michealbeatty
Copy link

Also fails on OS X and /usr/bin/diff does exist.

@Asbra
Copy link

Asbra commented Feb 23, 2016

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.

@Emif07
Copy link

Emif07 commented Feb 28, 2016

For mac also it seems double-quote breaks it.

@dltacube
Copy link

Removing the double quotes for me didn't fix it however...

@Apollon77
Copy link

I have the same problem on MacOS too ... Anyone managed to get it fixed?

@Apollon77
Copy link

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 :-( ...

@nikitakit
Copy link

nikitakit commented Feb 11, 2017

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.

@tagplus5
Copy link

tagplus5 commented Mar 8, 2017

See my diff tool command explanation #375

@craigmakin
Copy link

craigmakin commented May 4, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests