Skip to content

Commit 206b637

Browse files
committed
return non-zero if ssh config skips any codespaces
1 parent a9d02a7 commit 206b637

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/cmd/codespace/ssh.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,12 @@ func (a *App) printOpenSSHConfig(ctx context.Context, opts configOptions) error
205205
// it once per repository.
206206
sshUsers := map[string]string{}
207207

208+
var status error
208209
for _, cs := range codespaces {
209210

210211
if cs.State != "Available" {
211212
fmt.Fprintf(os.Stderr, "skipping unavailable codespace %s: %s\n", cs.Name, cs.State)
213+
status = cmdutil.SilentError
212214
continue
213215
}
214216

@@ -226,6 +228,7 @@ func (a *App) printOpenSSHConfig(ctx context.Context, opts configOptions) error
226228
// Move on to the next codespace. We don't want to bail here - just because we're not
227229
// able to set up connectivity to one doesn't mean we shouldn't make a best effort to
228230
// generate configs for the rest of them.
231+
status = cmdutil.SilentError
229232
continue
230233
}
231234
defer session.Close()
@@ -235,6 +238,7 @@ func (a *App) printOpenSSHConfig(ctx context.Context, opts configOptions) error
235238
a.StopProgressIndicator()
236239
if err != nil {
237240
fmt.Fprintf(os.Stderr, "error getting ssh server details: %v", err)
241+
status = cmdutil.SilentError
238242
continue // see above
239243
}
240244
sshUsers[cs.Repository.FullName] = sshUser
@@ -251,7 +255,7 @@ func (a *App) printOpenSSHConfig(ctx context.Context, opts configOptions) error
251255
}
252256
}
253257

254-
return nil
258+
return status
255259
}
256260

257261
// codespaceSSHConfig contains values needed to write an OpenSSH host

0 commit comments

Comments
 (0)