Skip to content

Commit afa71c4

Browse files
committed
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 ```
1 parent 3d28c52 commit afa71c4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/cmd/codespace/ssh.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ func (a *App) SSH(ctx context.Context, sshArgs []string, opts sshOptions) (err e
128128
return fmt.Errorf("get or choose codespace: %w", err)
129129
}
130130

131+
if codespace.PendingOperation {
132+
return fmt.Errorf(
133+
"codespace is disabled while it has a pending operation: %s",
134+
codespace.PendingOperationDisabledReason,
135+
)
136+
}
137+
131138
liveshareLogger := noopLogger()
132139
if opts.debug {
133140
debugLogger, err := newFileLogger(opts.debugFile)

0 commit comments

Comments
 (0)