提交 97e1f539 编写于 作者: K kohsuke

make sure we catch all the output before moving on

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@17023 71c3de6d-444a-0410-be80-ed276b4c234a
上级 4adbf1c9
......@@ -126,6 +126,7 @@ public abstract class SU {
else // in production code this never happens, but during debugging this is convenientud
args.add("-cp").add(slaveJar).add(hudson.remoting.Launcher.class.getName());
StreamCopyThread thread=null;
if(rootPassword==null) {
// try sudo, in the hope that the user has the permission to do so without password
channel = new LocalLauncher(listener).launchChannel(
......@@ -136,7 +137,8 @@ public abstract class SU {
proc = sudoWithPass(args);
channel = new Channel(args.toStringWithQuote(), Computer.threadPoolForRemoting,
proc.getInputStream(), proc.getOutputStream(), listener.getLogger());
new StreamCopyThread(args.toStringWithQuote()+" stderr",proc.getErrorStream(),listener.getLogger()).start();
thread = new StreamCopyThread(args.toStringWithQuote() + " stderr", proc.getErrorStream(), listener.getLogger());
thread.start();
}
try {
......@@ -146,6 +148,8 @@ public abstract class SU {
channel.join(3000); // give some time for orderly shutdown, but don't block forever.
if(proc!=null)
proc.destroy();
if(thread!=null)
thread.join();
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册