Skip to content
Permalink
Browse files
JENKINS-18094 Xvfb plugin doesn't write any error message in build log
  • Loading branch information
Zoran Regvart committed Jun 1, 2013
1 parent abf68cb commit 7f2d3b3ae412130a6d90c8a073873c1a5e504c98
Showing 2 changed files with 21 additions and 6 deletions.
@@ -39,14 +39,17 @@
import hudson.model.Executor;
import hudson.model.Node;
import hudson.model.Run;
import hudson.model.Run.RunnerAbortedException;
import hudson.model.listeners.RunListener;
import hudson.tasks.BuildWrapper;
import hudson.tasks.BuildWrapperDescriptor;
import hudson.tools.ToolInstallation;
import hudson.util.ArgumentListBuilder;
import hudson.util.FormValidation;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Map;

import net.sf.json.JSONObject;
@@ -296,18 +299,29 @@ private XvfbEnvironment launchXvfb(@SuppressWarnings("rawtypes") final AbstractB

final ProcStarter procStarter = launcher.launch().cmds(cmd);

final OutputStream stdout = debug ? listener.getLogger() : new ByteArrayOutputStream();
final OutputStream stderr = debug ? listener.getLogger() : new ByteArrayOutputStream();

listener.getLogger().print(Messages.XvfbBuildWrapper_Starting());
if (debug) {
procStarter.stdout(listener).stderr(listener.getLogger());
}
else {
procStarter.stdout(TaskListener.NULL);
}
procStarter.stdout(stdout).stderr(stderr);

final Proc process = procStarter.start();

Thread.sleep(timeout * MILLIS_IN_SECOND);

if (!process.isAlive()) {
if (!debug) {
listener.getLogger().write(((ByteArrayOutputStream) stdout).toByteArray());
listener.getLogger().write(((ByteArrayOutputStream) stderr).toByteArray());
}

listener.getLogger().println();

listener.error(Messages.XvfbBuildWrapper_FailedToStart());

throw new RunnerAbortedException();
}

final XvfbEnvironment xvfbEnvironment = new XvfbEnvironment(frameBufferDir, displayNameUsed, process, shutdownWithBuild);

return xvfbEnvironment;
@@ -26,6 +26,7 @@ XvfbBuildWrapper.NotUnix = System is not Unix, Xvfb will not be started
XvfbBuildWrapper.Starting = Xvfb starting
XvfbBuildWrapper.Stopping = Xvfb stopping
XvfbBuildWrapper.NoInstallationsConfigured = No Xvfb installations defined, please define one in the configuration. Once defined you'll need to choose one under Advanced options for Xvfb plugin job settings and save job configuration.
XvfbBuildWrapper.FailedToStart = Xvfb failed to start, consult the lines above for errors

XvfbInstallation.DisplayName = Xvfb installation
XvfbInstallation.HomeNotDirectory = Home path is not a directory: {0}

0 comments on commit 7f2d3b3

Please sign in to comment.