flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aljos...@apache.org
Subject flink git commit: [FLINK-3393] [core] ExternalProcessRunner wait to finish copying error stream
Date Fri, 12 Feb 2016 22:04:31 GMT
Repository: flink
Updated Branches:
  refs/heads/master 8b7caaa22 -> 8e55bbd41


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


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/8e55bbd4
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/8e55bbd4
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/8e55bbd4

Branch: refs/heads/master
Commit: 8e55bbd41725cd8c7f29a9e41993a22777ebdacf
Parents: 8b7caaa
Author: Greg Hogan <code@greghogan.com>
Authored: Fri Feb 12 08:38:05 2016 -0500
Committer: Aljoscha Krettek <aljoscha.krettek@gmail.com>
Committed: Fri Feb 12 23:04:06 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/flink/util/ExternalProcessRunner.java     | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/8e55bbd4/flink-core/src/main/java/org/apache/flink/util/ExternalProcessRunner.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/util/ExternalProcessRunner.java b/flink-core/src/main/java/org/apache/flink/util/ExternalProcessRunner.java
index 8e4725c..b7e388c 100644
--- a/flink-core/src/main/java/org/apache/flink/util/ExternalProcessRunner.java
+++ b/flink-core/src/main/java/org/apache/flink/util/ExternalProcessRunner.java
@@ -41,6 +41,8 @@ public class ExternalProcessRunner {
 
 	private final Process process;
 
+	private final Thread pipeForwarder;
+
 	final StringWriter errorOutput = new StringWriter();
 
 	/**
@@ -63,7 +65,7 @@ public class ExternalProcessRunner {
 
 		process = new ProcessBuilder(commandList).start();
 
-		new PipeForwarder(process.getErrorStream(), errorOutput);
+		pipeForwarder = new PipeForwarder(process.getErrorStream(), errorOutput);
 	}
 
 	/**
@@ -83,6 +85,9 @@ public class ExternalProcessRunner {
 		try {
 			int returnCode = process.waitFor();
 
+			// wait to finish copying standard error stream
+			pipeForwarder.join();
+
 			if (returnCode != 0) {
 				// determine whether we failed because of a ClassNotFoundException and forward that
 				if (getErrorOutput().toString().contains("Error: Could not find or load main class "
+ entryPointClassName)) {


Mime
View raw message