提交 81f49bd5 编写于 作者: J Jesse Glick

Merge pull request #817 from tlantz/master

[JENKINS-18368]: Decorated Launcher Does Not Maintain "isUnix" for RemoteLauncher
......@@ -664,6 +664,11 @@ public abstract class Launcher {
public final Launcher decorateByPrefix(final String... prefix) {
final Launcher outer = this;
return new Launcher(outer) {
@Override
public boolean isUnix() {
return outer.isUnix();
}
@Override
public Proc launch(ProcStarter starter) throws IOException {
starter.commands.addAll(0,Arrays.asList(prefix));
......@@ -711,6 +716,11 @@ public abstract class Launcher {
final EnvVars env = new EnvVars(_env);
final Launcher outer = this;
return new Launcher(outer) {
@Override
public boolean isUnix() {
return outer.isUnix();
}
@Override
public Proc launch(ProcStarter starter) throws IOException {
EnvVars e = new EnvVars(env);
......
......@@ -24,6 +24,7 @@
package hudson;
import jenkins.model.Jenkins;
import hudson.model.StreamBuildListener;
import hudson.model.TaskListener;
import hudson.util.ProcessTree;
......@@ -92,4 +93,28 @@ public class LauncherTest extends ChannelTestCase {
assertTrue(log, log.contains("val1 val2"));
}
@Bug(18368)
public void testDecoratedByEnvMaintainsIsUnix() throws Exception {
ByteArrayOutputStream output = new ByteArrayOutputStream();
TaskListener listener = new StreamBuildListener(output);
Launcher remoteLauncher = new Launcher.RemoteLauncher(listener, Jenkins.MasterComputer.localChannel, false);
Launcher decorated = remoteLauncher.decorateByEnv(new EnvVars());
assertEquals(false, decorated.isUnix());
remoteLauncher = new Launcher.RemoteLauncher(listener, Jenkins.MasterComputer.localChannel, true);
decorated = remoteLauncher.decorateByEnv(new EnvVars());
assertEquals(true, decorated.isUnix());
}
@Bug(18368)
public void testDecoratedByPrefixMaintainsIsUnix() throws Exception {
ByteArrayOutputStream output = new ByteArrayOutputStream();
TaskListener listener = new StreamBuildListener(output);
Launcher remoteLauncher = new Launcher.RemoteLauncher(listener, Jenkins.MasterComputer.localChannel, false);
Launcher decorated = remoteLauncher.decorateByPrefix("test");
assertEquals(false, decorated.isUnix());
remoteLauncher = new Launcher.RemoteLauncher(listener, Jenkins.MasterComputer.localChannel, true);
decorated = remoteLauncher.decorateByPrefix("test");
assertEquals(true, decorated.isUnix());
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册