(ctx context.Context, d *internal.Display, req *proto.ExecRequest)
| 234 | } |
| 235 | |
| 236 | func runExecHeadless(ctx context.Context, d *internal.Display, req *proto.ExecRequest) (*proto.ConfirmationContent, error) { |
| 237 | var confirmation *proto.ConfirmationContent |
| 238 | var lastSeq int32 |
| 239 | outputHandler := controller.ExecHandler(func(resp *proto.ExecResponse) error { |
| 240 | for _, m := range resp.Outputs { |
| 241 | if conf := m.GetContent().GetConfirmation(); conf != nil { |
| 242 | confirmation = conf |
| 243 | } |
| 244 | } |
| 245 | lastSeq = resp.Seq |
| 246 | displayContents(d, resp.Outputs) |
| 247 | return nil |
| 248 | }) |
| 249 | if err := execController.Exec(ctx, req, outputHandler); err != nil { |
| 250 | return nil, fmt.Errorf("error executing with local server: %w", err) |
| 251 | } |
| 252 | |
| 253 | if confirmation == nil { |
| 254 | d.FinishOutput(fmt.Sprintf("seq=%d", lastSeq)) |
| 255 | } |
| 256 | return confirmation, nil |
| 257 | } |
| 258 | |
| 259 | func runExecServer(ctx context.Context, d *internal.Display, req *proto.ExecRequest) (*proto.ConfirmationContent, error) { |
| 260 | conn, err := connect(execServerAddr) |
nothing calls this directly
no test coverage detected