TSystem::GetFromPipe because it returns the output as a string as not place to return the error code of the underlying command. In the case of diff, it returns a non zero error code if the two files are different.
To avoid the message, you will need to use directly OpenPipe and ClosePipe, similar to the implementation of GetFromPipe:
[code] TString out;
FILE *pipe = OpenPipe(command, “r”);
if (!pipe) {
SysError(“GetFromPipe”, “cannot run command “%s””, command);
return out;
}
TString line;
while (line.Gets(pipe)) {
if (out != “”)
out += “\n”;
out += line;
}
Int_t r = ClosePipe(pipe);
if ® {
// Ignore the error.
// Error(“GetFromPipe”, “command “%s” returned %d”, command, r);
}
[/code]
[quote]It is strange though that “diff” returns an error code even if the comparison of input files finished successfully.[/quote]It is completely intentional on the part of the diff developer. This way you can detect (in a shell script) whether two files are identical or not without have to parse the output.