MCPcopy Create free account
hub / github.com/coder/agentapi / SetupProcess

Function SetupProcess

lib/httpapi/setup.go:27–51  ·  view source on GitHub ↗
(ctx context.Context, config SetupProcessConfig)

Source from the content-addressed store, hash-verified

25}
26
27func 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
53type SetupACPConfig struct {
54 Program string

Callers 1

runServerFunction · 0.92

Calls 3

FromFunction · 0.92
StartProcessFunction · 0.92
WriteMethod · 0.65

Tested by

no test coverage detected