yongkangchen / remote-sync

Upload your files to remote host after every change. Both SCP/SFTP and FTP are supported.
https://atom.io/packages/remote-sync
MIT License
237 stars 71 forks source link

Diff operation fails #164

Open jegra opened 9 years ago

jegra commented 9 years ago

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 commented 9 years ago

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 commented 8 years ago

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

ffflorian commented 8 years ago

@yongkangchen

Yes, it exists:

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

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

Asbra commented 8 years ago

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 commented 8 years ago

For mac also it seems double-quote breaks it.

dltacube commented 8 years ago

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

Apollon77 commented 7 years ago

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

Apollon77 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

See my diff tool command explanation https://github.com/yongkangchen/remote-sync/pull/375

craigmakin commented 4 years ago

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