Skip to content

Commit

Permalink
Change ssh heartbeat type to IGNORE (#15858)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanwenjun authored Apr 16, 2024
1 parent ead5453 commit 9437d27
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static ClientSession getSession(SshClient client, SSHConnectionParam conn
throw new Exception("Failed to add public key identity", e);
}
}
session.setSessionHeartbeat(SessionHeartbeatController.HeartbeatType.RESERVED, Duration.ofSeconds(3));
session.setSessionHeartbeat(SessionHeartbeatController.HeartbeatType.IGNORE, Duration.ofSeconds(3));
return session;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ public Integer getTaskExitCode(String taskId) throws IOException {
}
}
cleanData(taskId);
log.error("Remote shell task failed");
return exitCode;
}

Expand Down Expand Up @@ -232,8 +231,10 @@ public String runRemote(String command) throws IOException {
channel.open();
channel.waitFor(EnumSet.of(ClientChannelEvent.CLOSED), 0);
channel.close();
if (channel.getExitStatus() != 0) {
throw new TaskException("Remote shell task error, error message: " + err.toString());
Integer exitStatus = channel.getExitStatus();
if (exitStatus == null || exitStatus != 0) {
throw new TaskException(
"Remote shell task error, exitStatus: " + exitStatus + " error message: " + err);
}
return out.toString();
}
Expand Down

0 comments on commit 9437d27

Please sign in to comment.