(ctx context.Context, config SetupProcessConfig)
| 25 | } |
| 26 | |
| 27 | func SetupProcess(ctx context.Context, config SetupProcessConfig) (*termexec.Process, error) { |
| 28 | logger := logctx.From(ctx) |
| 29 | |
| 30 | logger.Info(fmt.Sprintf("Running: %s %s", config.Program, strings.Join(config.ProgramArgs, " "))) |
| 31 | |
| 32 | process, err := termexec.StartProcess(ctx, termexec.StartProcessConfig{ |
| 33 | Program: config.Program, |
| 34 | Args: config.ProgramArgs, |
| 35 | TerminalWidth: config.TerminalWidth, |
| 36 | TerminalHeight: config.TerminalHeight, |
| 37 | }) |
| 38 | if err != nil { |
| 39 | logger.Error(fmt.Sprintf("Error starting process: %v", err)) |
| 40 | os.Exit(1) |
| 41 | } |
| 42 | |
| 43 | // Hack for sourcegraph amp to stop the animation. |
| 44 | if config.AgentType == mf.AgentTypeAmp { |
| 45 | _, err = process.Write([]byte(" \b")) |
| 46 | if err != nil { |
| 47 | return nil, err |
| 48 | } |
| 49 | } |
| 50 | return process, nil |
| 51 | } |
| 52 | |
| 53 | type SetupACPConfig struct { |
| 54 | Program string |
no test coverage detected