You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2020/11/13 15:06:09 UTC

[brooklyn-server] 03/05: Buffer the text stream from winrm4j

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

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git

commit a7704d0e1ead1d5f568eb7f2ddf833b39c5ebc33
Author: Duncan Grant <du...@cloudsoft.io>
AuthorDate: Thu Nov 12 14:35:37 2020 +0000

    Buffer the text stream from winrm4j
    
    In case of craziness coming from the winrm4j script.
---
 .../brooklyn/util/core/internal/winrm/winrm4j/Winrm4jTool.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/software/winrm/src/main/java/org/apache/brooklyn/util/core/internal/winrm/winrm4j/Winrm4jTool.java b/software/winrm/src/main/java/org/apache/brooklyn/util/core/internal/winrm/winrm4j/Winrm4jTool.java
index 4295168..0ce9bc5 100644
--- a/software/winrm/src/main/java/org/apache/brooklyn/util/core/internal/winrm/winrm4j/Winrm4jTool.java
+++ b/software/winrm/src/main/java/org/apache/brooklyn/util/core/internal/winrm/winrm4j/Winrm4jTool.java
@@ -118,8 +118,8 @@ public class Winrm4jTool implements org.apache.brooklyn.util.core.internal.winrm
         return exec(tool -> {
             OutputStream outputStream = bag.get(ShellTool.PROP_OUT_STREAM);
             OutputStream errorStream = bag.get(ShellTool.PROP_ERR_STREAM);
-            Writer out = outputStream != null ? new OutputStreamWriter(outputStream): new StringWriter();
-            Writer err = errorStream != null ? new OutputStreamWriter(errorStream): new StringWriter();
+            Writer out = outputStream != null ? new BufferedWriter(new OutputStreamWriter(outputStream)): new StringWriter();
+            Writer err = errorStream != null ? new BufferedWriter(new OutputStreamWriter(errorStream)): new StringWriter();
             return tool.executeCommand(commands, out, err);
         });
     }
@@ -135,8 +135,8 @@ public class Winrm4jTool implements org.apache.brooklyn.util.core.internal.winrm
         return exec(tool -> {
             OutputStream outputStream = bag.get(ShellTool.PROP_OUT_STREAM);
             OutputStream errorStream = bag.get(ShellTool.PROP_ERR_STREAM);
-            Writer out = outputStream != null ? new OutputStreamWriter(outputStream): new StringWriter();
-            Writer err = errorStream != null ? new OutputStreamWriter(errorStream): new StringWriter();
+            Writer out = outputStream != null ? new BufferedWriter(new OutputStreamWriter(outputStream)): new StringWriter();
+            Writer err = errorStream != null ? new BufferedWriter(new OutputStreamWriter(errorStream)): new StringWriter();
             return tool.executePs(commands, out, err);
         });
     }