提交 8e55bbd4 编写于 作者: G Greg Hogan 提交者: Aljoscha Krettek

[FLINK-3393] [core] ExternalProcessRunner wait to finish copying error stream

上级 8b7caaa2
...@@ -41,6 +41,8 @@ public class ExternalProcessRunner { ...@@ -41,6 +41,8 @@ public class ExternalProcessRunner {
private final Process process; private final Process process;
private final Thread pipeForwarder;
final StringWriter errorOutput = new StringWriter(); final StringWriter errorOutput = new StringWriter();
/** /**
...@@ -63,7 +65,7 @@ public class ExternalProcessRunner { ...@@ -63,7 +65,7 @@ public class ExternalProcessRunner {
process = new ProcessBuilder(commandList).start(); process = new ProcessBuilder(commandList).start();
new PipeForwarder(process.getErrorStream(), errorOutput); pipeForwarder = new PipeForwarder(process.getErrorStream(), errorOutput);
} }
/** /**
...@@ -83,6 +85,9 @@ public class ExternalProcessRunner { ...@@ -83,6 +85,9 @@ public class ExternalProcessRunner {
try { try {
int returnCode = process.waitFor(); int returnCode = process.waitFor();
// wait to finish copying standard error stream
pipeForwarder.join();
if (returnCode != 0) { if (returnCode != 0) {
// determine whether we failed because of a ClassNotFoundException and forward that // determine whether we failed because of a ClassNotFoundException and forward that
if (getErrorOutput().toString().contains("Error: Could not find or load main class " + entryPointClassName)) { if (getErrorOutput().toString().contains("Error: Could not find or load main class " + entryPointClassName)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册