Skip to content

Commit

Permalink
Merge pull request #110 from jglick/CLI-JENKINS-41745
Browse files Browse the repository at this point in the history
[JENKINS-41745] Allow SupportCommand to work without a Remoting channel
  • Loading branch information
christ66 committed Apr 6, 2017
2 parents 17ac515 + 18e6402 commit 9b34425
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -25,6 +25,7 @@
package com.cloudbees.jenkins.support;

import com.cloudbees.jenkins.support.api.Component;
import hudson.CloseProofOutputStream;
import hudson.Extension;
import hudson.cli.CLICommand;
import hudson.remoting.RemoteOutputStream;
Expand Down Expand Up @@ -81,7 +82,13 @@ protected int run() throws Exception {
try {
SecurityContext old = ACL.impersonate(ACL.SYSTEM);
try {
SupportPlugin.writeBundle(checkChannel().call(new SaveBundle(SupportPlugin.getBundleFileName())), selected);
OutputStream os;
if (channel != null) { // Remoting mode
os = channel.call(new SaveBundle(SupportPlugin.getBundleFileName()));
} else { // redirect output to a ZIP file yourself
os = new CloseProofOutputStream(stdout);
}
SupportPlugin.writeBundle(os, selected);
} finally {
SecurityContextHolder.setContext(old);
}
Expand Down

0 comments on commit 9b34425

Please sign in to comment.