Skip to content

Commit a61967f

Browse files
committed
Show launcher output on remote agent exec failure
Remote agent launch may fail for several reasons. Most common one is the agent not being installed on remote, but it may also come from a launcher failure. Show launcher output to help debugging.
1 parent ea332f1 commit a61967f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/com/cloudbees/jenkins/plugins/sshagent/exec/ExecRemoteAgent.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ public class ExecRemoteAgent implements RemoteAgent {
6363
ByteArrayOutputStream baos = new ByteArrayOutputStream();
6464
if (launcherProvider.getLauncher().launch().cmds("ssh-agent").stdout(baos).start()
6565
.joinWithTimeout(1, TimeUnit.MINUTES, listener) != 0) {
66-
throw new AbortException("Failed to run ssh-agent");
66+
String reason = new String(baos.toByteArray(), StandardCharsets.US_ASCII);
67+
throw new AbortException("Failed to run ssh-agent: " + reason);
6768
}
6869
agentEnv = parseAgentEnv(new String(baos.toByteArray(), StandardCharsets.US_ASCII), listener); // TODO could include local filenames, better to look up remote charset
6970

0 commit comments

Comments
 (0)