[vcs] Log executable validation failure reason

This commit is contained in:
Kirill Likhodedov
2014-05-25 16:03:56 +04:00
parent 9b3a535612
commit 8dbda1f9c9
@@ -90,9 +90,22 @@ public abstract class ExecutableValidator {
commandLine.setExePath(executable);
CapturingProcessHandler handler = new CapturingProcessHandler(commandLine.createProcess(), CharsetToolkit.getDefaultSystemCharset());
ProcessOutput result = handler.runProcess(60 * 1000);
return !result.isTimeout() && (result.getExitCode() == 0) && result.getStderr().isEmpty();
boolean timeout = result.isTimeout();
int exitCode = result.getExitCode();
String stderr = result.getStderr();
if (timeout) {
LOG.warn("Validation of " + executable + " failed with a timeout");
}
if (exitCode != 0) {
LOG.warn("Validation of " + executable + " failed with non-zero exit code: " + exitCode);
}
if (!stderr.isEmpty()) {
LOG.warn("Validation of " + executable + " failed with a non-empty error output: " + stderr);
}
return !timeout && exitCode == 0 && stderr.isEmpty();
}
catch (Throwable ignored) {
catch (Throwable t) {
LOG.warn(t);
return false;
}
}