Added more specific detailed information regarding SSH executions, removed unnecessary methods
This commit is contained in:
parent
8ba7e8f83b
commit
504fc70e7f
|
@ -24,8 +24,7 @@ import net.schmizz.sshj.transport.verification.HostKeyVerifier
|
|||
import net.schmizz.sshj.transport.verification.PromiscuousVerifier
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.TimeoutException
|
||||
import java.util.concurrent.*
|
||||
|
||||
/**
|
||||
* see https://github.com/hierynomus/sshj
|
||||
|
@ -48,7 +47,7 @@ class SshExecOptions(val executor: Executor) {
|
|||
|
||||
private val ssh = SSHClient()
|
||||
|
||||
internal fun startProcess(timeout: Long, timeoutUnit: TimeUnit): Process {
|
||||
internal fun startProcess(timeout: Long, timeoutUnit: TimeUnit): SshProcess {
|
||||
if (strictHostCheck) {
|
||||
if (knownHostsFile != null) {
|
||||
ssh.loadKnownHosts(File(knownHostsFile!!))
|
||||
|
|
|
@ -18,15 +18,16 @@ package dorkbox.executor
|
|||
|
||||
import net.schmizz.sshj.SSHClient
|
||||
import net.schmizz.sshj.connection.channel.direct.Session
|
||||
import net.schmizz.sshj.connection.channel.direct.Signal
|
||||
import net.schmizz.sshj.transport.TransportException
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
import java.io.OutputStream
|
||||
|
||||
class SshProcess(private val ssh: SSHClient,
|
||||
private val session: Session,
|
||||
private val command: Session.Command) : Process() {
|
||||
/** The raw session information for this SSH connection **/
|
||||
val session: Session,
|
||||
|
||||
/** The raw command information for this SSH connection **/
|
||||
val command: Session.Command) : Process() {
|
||||
|
||||
private val outputStream = command.outputStream
|
||||
private val inputStream = command.inputStream
|
||||
|
@ -52,26 +53,6 @@ class SshProcess(private val ssh: SSHClient,
|
|||
return exitValue()
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a signal to the remote command.
|
||||
*
|
||||
* @param signal the signal
|
||||
*
|
||||
* @throws TransportException if error sending the signal
|
||||
*/
|
||||
@Throws(TransportException::class)
|
||||
fun signal(signal: Signal) {
|
||||
command.signal(signal)
|
||||
}
|
||||
|
||||
/**
|
||||
* If the command exit violently [with a signal][.getExitSignal], information about whether a core dump
|
||||
* took place would have been received and can be retrieved via this method.
|
||||
*/
|
||||
fun exitWasCoreDumped(): Boolean {
|
||||
return command.exitWasCoreDumped ?: false
|
||||
}
|
||||
|
||||
override fun exitValue(): Int {
|
||||
return if (command.isOpen) {
|
||||
PidHelper.INVALID.toInt()
|
||||
|
|
Loading…
Reference in New Issue