• Gustav Paul's avatar
    exp/ssh: Have Wait() return an *ExitError · 50c24bf6
    Gustav Paul authored
    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
    50c24bf6
session.go 12.2 KB