]> Cypherpunks repositories - gostls13.git/commit
exp/ssh: Have Wait() return an *ExitError
authorGustav Paul <gustav.paul@gmail.com>
Wed, 7 Dec 2011 14:58:22 +0000 (09:58 -0500)
committerAdam Langley <agl@golang.org>
Wed, 7 Dec 2011 14:58:22 +0000 (09:58 -0500)
commit50c24bf6ec4d05148012cbd010476f7151627424
tree9090f5c2ccef58e4c9cf79decb3d4067b5cc0dfc
parent428062da4e5e35ce75178d993dd6d8ef5e3ecb5d
exp/ssh: Have Wait() return an *ExitError

I added the clientChan's msg channel to the list of channels that are closed in mainloop when the server sends a channelCloseMsg.

I added an ExitError type that wraps a Waitmsg similar to that of os/exec. I fill ExitStatus with the data returned in the 'exit-status' channel message and Msg with the data returned in the 'exit-signal' channel message.

Instead of having Wait() return on the first 'exit-status'/'exit-signal' I have it return an ExitError containing the status and signal when the clientChan's msg channel is closed.

I added two tests cases to session_test.go that test for exit status 0 (in which case Wait() returns nil) and exit status 1 (in which case Wait() returns an ExitError with ExitStatus 1)

R=dave, agl, rsc, golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5452051
src/pkg/exp/ssh/client.go
src/pkg/exp/ssh/client_func_test.go
src/pkg/exp/ssh/session.go
src/pkg/exp/ssh/session_test.go