MCPcopy Index your code
hub / github.com/cli/cli / getPostCreateOutput

Function getPostCreateOutput

internal/codespaces/states.go:110–132  ·  view source on GitHub ↗
(ctx context.Context, tunnelPort int, user string)

Source from the content-addressed store, hash-verified

108}
109
110func 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
134func safeClose(closer io.Closer, err *error) {
135 if closeErr := closer.Close(); *err == nil {

Callers 1

PollPostCreateStatesFunction · 0.85

Calls 3

NewRemoteCommandFunction · 0.85
ErrorfMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected