ECMerge has a specific option "--sip" (Silent If Possible)
for the purpose of running silently unless there is a
conflict.
In order to activate it you just have to call ECMerge that
way:
On Unix based OS (Linux, Solaris, Mac OS X...)
ecmerge --sip ancestor left right
--to=result-file
You can then test the return value of the process
with variable
$? if launched from a script or the result
of the spawn / wait-like call.
On Windows, it depends in which condition you expect to
use the result.
In a command file (.BAT or .CMD):
start "ECMerge" /wait ecmerge --sip ancestor left
right --to=result-file NB: this "start /wait" call is necessary else
Windows won't wait for the result of ECMerge and always
return 0 unless the process cannot be launched at all.
You can study the %ERRORLEVEL% batch variable to know
how ECMerge behaved.
Directly inside a CreateProcess call:
path/to/ecmerge --sip ancestor
left right --to=result-file
You can study the result with GetExitCodeProcess
using the handle returned in the PROCESS_INFORMATION object
that you provided to CreateProcess.
In any case, ECMerge returns the following codes:
0 : there is no conflict and no error, the result was
saved as expected
1 : there are conflicts that the user needed to solve in
the UI and the user chose to dismiss the window without
validating
-1: there is an error, this error is written to the
standard output stream. Note that on Windows,
ecmerge is a GUI process and thus cannot
write to the standard output stream (because Windows closes
those streams before ECMerge has any chance to write to
them). You thus need to call "merge.exe" without --sip
and same parameters otherwise to diagnose the problem