File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
new-integration-tests/src/test/java/oracle/weblogic/kubernetes/utils Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -64,13 +64,8 @@ public static ExecResult exec(
64
64
Thread out = null ;
65
65
66
66
try {
67
- String stdout = null ;
68
67
if (isRedirectToOut ) {
69
68
InputStream i = in .getInputStream ();
70
- i .mark (0 );
71
- // read the stdout first, and reset before we redirect the output
72
- stdout = read (i );
73
- i .reset ();
74
69
@ SuppressWarnings ("resource" )
75
70
CopyingOutputStream copyOut = new CopyingOutputStream (System .out );
76
71
// this makes sense because CopyingOutputStream is an InputStreamWrapper
@@ -88,14 +83,17 @@ public static ExecResult exec(
88
83
}
89
84
90
85
p .waitFor ();
91
-
92
- // if we have not read the stdout, we do it now
93
- if (stdout == null ) {
94
- stdout = read (in .getInputStream ());
86
+
87
+ // we need to join the thread before we read the stdout so that the saved stdout is complete
88
+ if (out != null ) {
89
+ out .join ();
90
+ out = null ;
95
91
}
96
- return new ExecResult (p .exitValue (), stdout , read (p .getErrorStream ()));
92
+
93
+ return new ExecResult (p .exitValue (), read (in .getInputStream ()), read (p .getErrorStream ()));
97
94
98
95
} finally {
96
+ // we try to join again if for any reason the code failed before the previous attempt
99
97
if (out != null ) {
100
98
out .join ();
101
99
}
You can’t perform that action at this time.
0 commit comments