-
Notifications
You must be signed in to change notification settings - Fork 226
Conversation
e2e test seems to be flaky. It ran fine on my fork https://travis-ci.com/github/darkowlzz/ignite/builds/159927085 |
cmd/ignite/run/ssh.go
Outdated
if err := session.Wait(); err != nil { | ||
if e, ok := err.(*ssh.ExitError); ok { | ||
switch e.ExitStatus() { | ||
case 130: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should simply set the return code for the deferred os.Exit
} | ||
defer session.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before we defer the session.Close, we can defer an os.Exit (then they will run in reverse order)
The Exit should take a code variable:
https://stackoverflow.com/a/24601700
cmd/ignite/run/ssh.go
Outdated
} | ||
} else { | ||
if err := session.Run(joinShellCommand(command)); err != nil { | ||
return fmt.Errorf("failed to run shell command: %s", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please copy error checking and exit code logic for previous block here so behavior is consistent.
Please rebase on master which now includes #581 :) |
3e1d8fb
to
b969e99
Compare
Added a defer with |
838f01f
to
8e4053b
Compare
This change combines ssh and exec to use the same code. ssh no longer uses ssh binary on the host but uses go's crypto/ssh package to create a terminal session. Moves newSignerForKey, newSSHConfig and joinShellCommand functions from exec.go to ssh.go, keeping all ssh related functions in the same file.
Breaking change. Short flag -t changed from timeout to tty, similar to the exec command.
When the ssh session ends, the actual ssh exit code should be returned. This change adds a deferred os.Exit and sets any ssh error code received as the exit code.
3da3447
to
d92a74b
Compare
This change combines ssh and exec commands to use the same code. ssh no longer
uses ssh binary on the host but uses go's crypto/ssh package to create a
terminal session.
Moves
newSignerForKey
,newSSHConfig
and joinShellCommand functions fromexec.go to ssh.go, keeping all ssh related functions in the same file.