From decf17cb6916ffb29d045e5173454e8ab9a67b3e Mon Sep 17 00:00:00 2001 From: Eugene Kudelevsky Date: Thu, 27 Oct 2011 16:22:57 +0400 Subject: [PATCH] do not write output message if timeout is zero --- .../jetbrains/android/util/AndroidUtils.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/plugins/android/src/org/jetbrains/android/util/AndroidUtils.java b/plugins/android/src/org/jetbrains/android/util/AndroidUtils.java index d38aa80880a5..8a3c53a0aa5c 100644 --- a/plugins/android/src/org/jetbrains/android/util/AndroidUtils.java +++ b/plugins/android/src/org/jetbrains/android/util/AndroidUtils.java @@ -448,11 +448,15 @@ public class AndroidUtils { @Nullable Integer timeout) throws ExecutionException { LOG.info(commandLine.getCommandLineString()); OSProcessHandler handler = new OSProcessHandler(commandLine.createProcess(), ""); - handler.addProcessListener(new ProcessAdapter() { - public void onTextAvailable(final ProcessEvent event, final Key outputType) { - messageBuilder.append(event.getText()); - } - }); + + if (timeout != null && timeout != 0) { + handler.addProcessListener(new ProcessAdapter() { + public void onTextAvailable(final ProcessEvent event, final Key outputType) { + messageBuilder.append(event.getText()); + } + }); + } + handler.startNotify(); try { if (timeout != null) { @@ -472,8 +476,11 @@ public class AndroidUtils { return ExecutionStatus.TIMEOUT; } - String message = messageBuilder.toString(); - LOG.info(message); + if (timeout != null && timeout != 0) { + String message = messageBuilder.toString(); + LOG.info(message); + } + int exitCode = handler.getProcess().exitValue(); return exitCode == 0 ? ExecutionStatus.SUCCESS : ExecutionStatus.ERROR; }