Disallow ssh'ing to codespace with a pending operation
Since the API already disallows this, this makes the error cleaner and more explicit when a user is trying to start/ssh into a codespace that has a pending operation. Example of the old error message: ``` $ gh cs ssh -c cwndrws-redacted Starting codespace ⣽error connecting to codespace: error starting codespace: HTTP 422: your codespace has an operation pending: updating to a sku with a different amount of storage; please wait until this operation is complete (https://api.github.com/user/codespaces/cwndrws-redacted/start) exit status 1 ``` Example of the new error message: ``` $ gh cs ssh -c cwndrws-redacted codespace is disabled while it has a pending operation: Changing machine types... exit status 1 ```
This commit is contained in:
parent
3d28c52104
commit
afa71c4b2f
1 changed files with 7 additions and 0 deletions
|
|
@ -128,6 +128,13 @@ func (a *App) SSH(ctx context.Context, sshArgs []string, opts sshOptions) (err e
|
|||
return fmt.Errorf("get or choose codespace: %w", err)
|
||||
}
|
||||
|
||||
if codespace.PendingOperation {
|
||||
return fmt.Errorf(
|
||||
"codespace is disabled while it has a pending operation: %s",
|
||||
codespace.PendingOperationDisabledReason,
|
||||
)
|
||||
}
|
||||
|
||||
liveshareLogger := noopLogger()
|
||||
if opts.debug {
|
||||
debugLogger, err := newFileLogger(opts.debugFile)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue