mirror of
https://gogs.blitter.com/RLabs/xs
synced 2024-08-14 10:26:42 +00:00
client prints nonzero remote end exit status; comment cleanup
This commit is contained in:
parent
db1b494d00
commit
8a24fb113f
2 changed files with 9 additions and 3 deletions
|
@ -241,6 +241,9 @@ func doShellMode(isInteractive bool, conn *hkexnet.Conn, oldState *hkexsh.State,
|
||||||
_, inerr := io.Copy(os.Stdout, conn)
|
_, inerr := io.Copy(os.Stdout, conn)
|
||||||
if inerr != nil {
|
if inerr != nil {
|
||||||
_ = hkexsh.Restore(int(os.Stdin.Fd()), oldState) // Best effort.
|
_ = hkexsh.Restore(int(os.Stdin.Fd()), oldState) // Best effort.
|
||||||
|
// Copy operations and user logging off will cause
|
||||||
|
// a "use of closed network connection" so handle that
|
||||||
|
// gracefully here
|
||||||
if !strings.HasSuffix(inerr.Error(), "use of closed network connection") {
|
if !strings.HasSuffix(inerr.Error(), "use of closed network connection") {
|
||||||
log.Println(inerr)
|
log.Println(inerr)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -545,5 +548,8 @@ func main() {
|
||||||
_ = hkexsh.Restore(int(os.Stdin.Fd()), oldState) // Best effort.
|
_ = hkexsh.Restore(int(os.Stdin.Fd()), oldState) // Best effort.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if rec.status != 0 {
|
||||||
|
fmt.Fprintln(os.Stderr, "Remote end exited with status:", rec.status)
|
||||||
|
}
|
||||||
os.Exit(rec.status)
|
os.Exit(rec.status)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue