[yocto] [eclipse][PATCH 1/4] plugins/cmake: Allow multiple targets when logging process output

Timo Mueller mail at timomueller.eu
Thu May 22 02:58:19 PDT 2014


From: Timo Mueller <timo.mueller at bmw-carit.de>

Until now the stream pipe was connecting one input stream with one
output stream. This for example allowed showing the output of a process
in an eclipse console. If the output is required elsewhere, e.g. in a
message dialog, the only possiblity was to read out the whole console
afterwards.

The stream pipe is extended so that we can now write the process output
to multiple target while the process is running, e.g. a eclipse console
and a byte stream.

Signed-off-by: Timo Mueller <timo.mueller at bmw-carit.de>
---
 .../src/org/yocto/cmake/managedbuilder/util/SystemProcess.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java
index 9ca6e60..764a1f6 100644
--- a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java
+++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java
@@ -87,12 +87,12 @@ public class SystemProcess {
 
 	private class StreamPipe extends Thread {
 		private InputStream in;
-		private OutputStream out;
+		private OutputStream[] outputs;
 		boolean shutdown = false;
 
-		public StreamPipe(InputStream in, OutputStream out) {
+		public StreamPipe(InputStream in, OutputStream... outputs) {
 			this.in = in;
-			this.out = out;
+			this.outputs = outputs;
 		}
 
 		@Override
@@ -102,7 +102,9 @@ public class SystemProcess {
 
 			try {
 				while(!shutdown && ((length = in.read(buffer)) > -1)) {
-					out.write(buffer, 0, length);
+					for (OutputStream out : outputs) {
+						out.write(buffer, 0, length);
+					}
 				}
 			} catch (IOException e) {
 				e.printStackTrace();
-- 
1.9.0




More information about the yocto mailing list