jassh
jassh copied to clipboard
sudo hang
when try use 'become' run command with sudo, then program hang without any output or error. below is the code(some function).
def runWithSudo(cmdString: String): (Boolean, String) = {
log.info(
s"run command '${cmdString}' with sudo on '${this.user}@${this.host}:${this.port}'"
)
val sshOptions = this.sshOption()
var runState : Boolean = false
var runResult: String = ""
try {
SSH.once(sshOptions) { ssh => {
val (r1, r2) = ssh.shell { sh =>
sh.become("root") -> sh.execute(cmdString)
}
runState = r1
runResult = r2
}
}
} catch {
case ex: Exception => log.error("SSHHost.runWithSudo", ex)
}
(runState, runResult)
}
The SSHOption is only set user, host, port, all other is default.
I think there something wrong, what I can do? Thanks.