winmerge icon indicating copy to clipboard operation
winmerge copied to clipboard

ExitCode always 2 with /enableexitcode with no apparent issues

Open SESEric opened this issue 1 year ago • 5 comments

Ever since I upgraded to V2.16.42.1 i've been facing some issue with the program returning error 2 wheneever i comparer two big folders.

They seem like the program complete without any issues, and the log says that there are no differences.

I was wondering what could be wrong, is there a log that actually list what is the error ecountered?

Thank you!

SESEric avatar Sep 25 '24 19:09 SESEric

I have just downloaded 2.16.40 and i can confirm that the same folder and call to winmerge returns 0 (as expected) as opposed to 2

SESEric avatar Sep 25 '24 20:09 SESEric

In my environment, I was not able to reproduce the issue where the exit code is always 2 in the latest version.

Exit code 2 indicates that an error occurred while comparing folders.

Such an error occurs when another application has a file in the folder open exclusively and WinMerge cannot compare the file.

Or, if you run WinMerge from a command prompt or batch file, the exitcode may remain at its previous value if you refer to it without waiting for WinMerge to finish.

To wait for WinMerge to finish from a command prompt or batch file, use start /wait as follows:

start /wait "" "c:\Program Files\WinMerge\WinMergeU.exe" d:\dev\winmerge\src e:\dev\winmerge\src /noninteractive /enableexitcode
echo %errorlevel%

sdottaka avatar Sep 25 '24 22:09 sdottaka

Hi, thank you for the reply.

I am already waiting for the comparison to complete with a call similar to what you proposed.

This issue doesn’t happen always, on simplifier folders it works fine.

In my case I’m comparing bigger folder that contains binaries, exe and other type of files.

Also im outputting the result to a file and at the end the comparison log says that all files are the same.

Again if I rollback to the previous version the comparison works and the error code return is 0 like I would expect.

It is really hard to understand what could be the cause since there is no error message nor error log.

At this stage I’ll rollback to the previous version which is behaving fine.

Le 25 sept. 2024 à 6:50 p.m., Takashi Sawanaka @.***> a écrit :



In my environment, I was not able to reproduce the issue where the exit code is always 2 in the latest version.

Exit code 2 indicates that an error occurred while comparing folders.

Such an error occurs when another application has a file in the folder open exclusively and WinMerge cannot compare the file.

Or, if you run WinMerge from a command prompt or batch file, the exitcode may remain at its previous value if you refer to it without waiting for WinMerge to finish.

To wait for WinMerge to finish from a command prompt or batch file, use start /wait as follows:

start /wait "" "c:\Program Files\WinMerge\WinMergeU.exe" d:\dev\winmerge\src e:\dev\winmerge\src /noninteractive /enableexitcode echo %errorlevel%

— Reply to this email directly, view it on GitHubhttps://github.com/WinMerge/winmerge/issues/2450#issuecomment-2375407480, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BFTMROHB6HRXULCGWFXTPVDZYM427AVCNFSM6AAAAABO3IOIEKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZVGQYDONBYGA. You are receiving this because you authored the thread.Message ID: @.***>

SESEric avatar Sep 25 '24 23:09 SESEric

Ah, I was able to confirm that exitcode returns 2 when folder comparison takes a long time. I'll take a look at it later.

sdottaka avatar Sep 25 '24 23:09 sdottaka

I found that the exit status is 2 if the "Include unique subfolder contents" option in the Compare/Folder category of the Options window is turned off and one of the subfolders in the compared folders does not exist.

What about the above settings?

This issue was fixed in this commit https://github.com/WinMerge/winmerge/commit/1646333b0b38cdc3f6ef666d15d76b4fe8c48837.

sdottaka avatar Sep 29 '24 13:09 sdottaka

The fix in commit 1646333 is included in the latest stable version, 2.16.44. We will close this issue for now. Please reopen this issue if the issue reoccurs in the latest version.

sdottaka avatar Jan 07 '25 13:01 sdottaka