From 64dd2b64b59f260037122753815ee530a72d84ff Mon Sep 17 00:00:00 2001 From: kohsuke Date: Thu, 22 Feb 2007 01:42:11 +0000 Subject: [PATCH] refactored for better reusability. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@2241 71c3de6d-444a-0410-be80-ed276b4c234a --- remoting/src/main/java/hudson/remoting/Launcher.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/remoting/src/main/java/hudson/remoting/Launcher.java b/remoting/src/main/java/hudson/remoting/Launcher.java index a1964992b7..aba83d9949 100644 --- a/remoting/src/main/java/hudson/remoting/Launcher.java +++ b/remoting/src/main/java/hudson/remoting/Launcher.java @@ -1,6 +1,8 @@ package hudson.remoting; import java.io.OutputStream; +import java.io.IOException; +import java.io.InputStream; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -19,12 +21,15 @@ public class Launcher { // and messing up the stream. OutputStream os = System.out; System.setOut(System.err); + main(System.in,os); + System.exit(0); + } + public static void main(InputStream is, OutputStream os) throws IOException, InterruptedException { ExecutorService executor = Executors.newCachedThreadPool(); - Channel channel = new Channel("channel", executor, System.in, os); + Channel channel = new Channel("channel", executor, is, os); System.err.println("channel started"); channel.join(); System.err.println("channel stopped"); - System.exit(0); } } -- GitLab