Merge branch 'main' into runcommand
This commit is contained in:
commit
68792d5aa5
2 changed files with 8 additions and 5 deletions
10
api/api.go
10
api/api.go
|
|
@ -274,11 +274,17 @@ func (a *API) StartCodespace(ctx context.Context, token string, codespace *Codes
|
|||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
// Error response is numeric code and/or string message, not JSON.
|
||||
// Error response is typically a numeric code (not an error message, nor JSON).
|
||||
if len(b) > 100 {
|
||||
b = append(b[:97], "..."...)
|
||||
}
|
||||
return fmt.Errorf("failed to start codespace: %s", b)
|
||||
|
||||
if resp.StatusCode == http.StatusServiceUnavailable && strings.TrimSpace(string(b)) == "7" {
|
||||
// HTTP 503 with error code 7 (EnvironmentNotShutdown) is benign.
|
||||
// Ignore it.
|
||||
} else {
|
||||
return fmt.Errorf("failed to start codespace: %s", b)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/github/ghcs/api"
|
||||
"github.com/github/ghcs/cmd/ghcs/output"
|
||||
|
|
@ -173,8 +172,6 @@ func setupSSH(ctx context.Context, logger *output.Logger, terminal *liveshare.Te
|
|||
return fmt.Errorf("error closing stream: %v", err)
|
||||
}
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue