(ctx context.Context, sessionID string, cwd string, path string)
| 1355 | } |
| 1356 | |
| 1357 | func formatSandboxClientWrittenFile(ctx context.Context, sessionID string, cwd string, path string) error { |
| 1358 | if strings.TrimSpace(sessionID) == "" { |
| 1359 | return nil |
| 1360 | } |
| 1361 | spec, ok := sandboxRuntimeFormatSpecForPath(path) |
| 1362 | if !ok { |
| 1363 | return nil |
| 1364 | } |
| 1365 | resp, err := getSandboxClient().ExecuteShell(ctx, sandboxclient.ShellRequest{ |
| 1366 | Command: spec.command, |
| 1367 | Timeout: 20, |
| 1368 | SessionID: sessionID, |
| 1369 | Cwd: cwd, |
| 1370 | EnvVars: map[string]string{"SANDBOX_PREVIEW_PATH": path}, |
| 1371 | }) |
| 1372 | if err != nil { |
| 1373 | return wrapSandboxServiceError(err) |
| 1374 | } |
| 1375 | if resp.ExitCode != 0 { |
| 1376 | return fmt.Errorf("%s format failed: %s", path, formatCommandResult(resp.Stdout, resp.Stderr, resp.ExitCode)) |
| 1377 | } |
| 1378 | return nil |
| 1379 | } |
| 1380 | |
| 1381 | func preflightSandboxClientCode(ctx context.Context, sessionID string, cwd string, language string, code string) error { |
| 1382 | if strings.TrimSpace(sessionID) == "" || strings.TrimSpace(code) == "" { |
no test coverage detected