Clean up progress indicator if codespace fails to start

This commit is contained in:
Mislav Marohnić 2022-06-06 14:32:01 +02:00
parent 77507cd94c
commit 8c5ae36311

View file

@ -38,6 +38,7 @@ type logger interface {
func ConnectToLiveshare(ctx context.Context, progress progressIndicator, sessionLogger logger, apiClient apiClient, codespace *api.Codespace) (sess *liveshare.Session, err error) {
if codespace.State != api.CodespaceStateAvailable {
progress.StartProgressIndicatorWithLabel("Starting codespace")
defer progress.StopProgressIndicator()
if err := apiClient.StartCodespace(ctx, codespace.Name); err != nil {
return nil, fmt.Errorf("error starting codespace: %w", err)
}