(ctx context.Context, tunnelPort int, user string)
| 108 | } |
| 109 | |
| 110 | func getPostCreateOutput(ctx context.Context, tunnelPort int, user string) ([]PostCreateState, error) { |
| 111 | cmd, err := NewRemoteCommand( |
| 112 | ctx, tunnelPort, fmt.Sprintf("%s@localhost", user), |
| 113 | "cat /workspaces/.codespaces/shared/postCreateOutput.json", |
| 114 | ) |
| 115 | if err != nil { |
| 116 | return nil, fmt.Errorf("remote command: %w", err) |
| 117 | } |
| 118 | |
| 119 | stdout := new(bytes.Buffer) |
| 120 | cmd.Stdout = stdout |
| 121 | if err := cmd.Run(); err != nil { |
| 122 | return nil, fmt.Errorf("run command: %w", err) |
| 123 | } |
| 124 | var output struct { |
| 125 | Steps []PostCreateState `json:"steps"` |
| 126 | } |
| 127 | if err := json.Unmarshal(stdout.Bytes(), &output); err != nil { |
| 128 | return nil, fmt.Errorf("unmarshal output: %w", err) |
| 129 | } |
| 130 | |
| 131 | return output.Steps, nil |
| 132 | } |
| 133 | |
| 134 | func safeClose(closer io.Closer, err *error) { |
| 135 | if closeErr := closer.Close(); *err == nil { |
no test coverage detected