提交 7ef53f94 编写于 作者: K kohsuke

modified to simply inherit the environment when launching a sub-channel.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@2309 71c3de6d-444a-0410-be80-ed276b4c234a
上级 8acd07eb
......@@ -97,9 +97,8 @@ public abstract class Launcher {
* return it.
*
* @param out
* The stderr from the launched process will be sent to this stream.
*/
public abstract Channel launchChannel(String[] cmd, String[] env, OutputStream out, FilePath workDir) throws IOException;
public abstract Channel launchChannel(String[] cmd, OutputStream out, FilePath workDir) throws IOException;
/**
* Returns true if this {@link Launcher} is going to launch on Unix.
......@@ -146,10 +145,10 @@ public abstract class Launcher {
return f==null ? null : new File(f.getRemote());
}
public Channel launchChannel(String[] cmd, String[] env, OutputStream out, FilePath workDir) throws IOException {
public Channel launchChannel(String[] cmd, OutputStream out, FilePath workDir) throws IOException {
printCommandLine(cmd, workDir);
Process proc = Runtime.getRuntime().exec(cmd, env, toFile(workDir));
Process proc = Runtime.getRuntime().exec(cmd, null, toFile(workDir));
// TODO: don't we need the equivalent of 'Proc' here? to abort it
......
......@@ -254,7 +254,7 @@ public class MavenBuild extends AbstractBuild<MavenModule,MavenBuild> {
// start maven process
ArgumentListBuilder args = buildMavenCmdLine(listener);
Channel channel = launcher.launchChannel(args.toCommandArray(), new String[0],
Channel channel = launcher.launchChannel(args.toCommandArray(),
listener.getLogger(), getProject().getModuleRoot());
// Maven started.
......
......@@ -421,14 +421,14 @@ public final class Slave implements Node, Serializable {
return new RemoteProc(getChannel().callAsync(new RemoteLaunchCallable(cmd, env, in, out, workDir)));
}
public Channel launchChannel(String[] cmd, String[] env, OutputStream err, FilePath _workDir) throws IOException {
public Channel launchChannel(String[] cmd, OutputStream err, FilePath _workDir) throws IOException {
printCommandLine(cmd, _workDir);
Pipe in = Pipe.createLocalToRemote();
Pipe out = Pipe.createRemoteToLocal();
final String workDir = _workDir==null ? null : _workDir.getRemote();
getChannel().callAsync(new RemoteChannelLaunchCallable(cmd, env, in, out, workDir));
getChannel().callAsync(new RemoteChannelLaunchCallable(cmd, in, out, workDir));
return new Channel("remotely launched channel on "+getNodeName(),
Computer.threadPoolForRemoting, out.getIn(), in.getOut());
......@@ -521,21 +521,19 @@ public final class Slave implements Node, Serializable {
private static class RemoteChannelLaunchCallable implements Callable<Integer,IOException> {
private final String[] cmd;
private final String[] env;
private final Pipe in;
private final Pipe out;
private final String workDir;
public RemoteChannelLaunchCallable(String[] cmd, String[] env, Pipe in, Pipe out, String workDir) {
public RemoteChannelLaunchCallable(String[] cmd, Pipe in, Pipe out, String workDir) {
this.cmd = cmd;
this.env = env;
this.in = in;
this.out = out;
this.workDir = workDir;
}
public Integer call() throws IOException {
Proc p = new LocalLauncher(TaskListener.NULL).launch(cmd, env, in.getIn(), out.getOut(),
Proc p = new LocalLauncher(TaskListener.NULL).launch(cmd, null, in.getIn(), out.getOut(),
workDir ==null ? null : new FilePath(new File(workDir)));
return p.join();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册