func TestExitSignalAndStatus(t *testing.T) {
	conn := dial(exitSignalAndStatusHandler, t)
	defer conn.Close()
	session, err := conn.NewSession()
	if err != nil {
		t.Fatalf("Unable to request new session: %v", err)
	}
	defer session.Close()
	if err := session.Shell(); err != nil {
		t.Fatalf("Unable to execute command: %v", err)
	}
	err = session.Wait()
	if err == nil {
		t.Fatalf("expected command to fail but it didn't")
	}
	e, ok := err.(*ExitError)
	if !ok {
		t.Fatalf("expected *ExitError but got %T", err)
	}
	if e.Signal() != "TERM" || e.ExitStatus() != 15 {
		t.Fatalf("expected command to exit with signal TERM and status 15 but got signal %s and status %v", e.Signal(), e.ExitStatus())
	}
}
// Test exit signal and status are both returned correctly.
Test exit signal and status are both returned correctly.
// Test exit signal and status are both returned correctly .
func TestExitSignalAndStatus(t *testing.T) {
	conn := dial(exitSignalAndStatusHandler, t)
	defer conn.Close()
	session, err := conn.NewSession()
	if err != nil {
		t.Fatalf("Unable to request new session: %v", err)
	}
	defer session.Close()
	if err := session.Shell(); err != nil {
		t.Fatalf("Unable to execute command: %v", err)
	}
	err = session.Wait()
	if err == nil {
		t.Fatalf("expected command to fail but it didn't")
	}
	e, ok := err.(*ExitError)
	if !ok {
		t.Fatalf("expected *ExitError but got %T", err)
	}
	if e.Signal() != "TERM" || e.ExitStatus() != 15 {
		t.Fatalf("expected command to exit with signal TERM and status 15 but got signal %s and status %v", e.Signal(), e.ExitStatus())
	}
}
func TestExitSignalAndStatus ( t * testing . T ) { conn := dial ( exitSignalAndStatusHandler , t ) defer conn . Close ( ) session , err := conn . NewSession ( ) if err != nil { t . Fatalf ( " " , err ) } defer session . Close ( ) if err := session . Shell ( ) ; err != nil { t . Fatalf ( " " , err ) } err = session . Wait ( ) if err == nil { t . Fatalf ( " " ) } e , ok := err . ( * ExitError ) if ! ok { t . Fatalf ( " " , err ) } if e . Signal ( ) != " " || e . ExitStatus ( ) != 15 { t . Fatalf ( " " , e . Signal ( ) , e . ExitStatus ( ) ) } }
Test exit signal and status are both returned correctly.
Test exit signal and status are both returned correctly .