You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by si...@apache.org on 2019/02/25 05:36:20 UTC

[bookkeeper] branch master updated: Log error (if any) in Shell.runCommand

This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new b829eb2  Log error (if any) in Shell.runCommand
b829eb2 is described below

commit b829eb2e11d211cefb283c0919f2b893d30d2f35
Author: Charan Reddy Guttapalem <re...@gmail.com>
AuthorDate: Sun Feb 24 21:36:16 2019 -0800

    Log error (if any) in Shell.runCommand
    
    
    
    Descriptions of the changes in this PR:
    - Log error (if any) in Shell.runCommand even in the case of successful execution
    
    Reviewers: Enrico Olivelli <eo...@gmail.com>, Sijie Guo <si...@apache.org>
    
    This closes #1956 from reddycharan/printshellerror
---
 .../src/main/java/org/apache/bookkeeper/util/Shell.java              | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/Shell.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/Shell.java
index 60c7648..8067a60 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/Shell.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/Shell.java
@@ -176,6 +176,11 @@ public abstract class Shell {
             //taken care in finally block
             if (exitCode != 0) {
                 throw new ExitCodeException(exitCode, errMsg.toString());
+            } else {
+                String errMsgStr = errMsg.toString();
+                if (!errMsgStr.isEmpty()) {
+                    LOG.error(errMsgStr);
+                }
             }
         } catch (InterruptedException ie) {
             Thread.currentThread().interrupt();