MCPcopy Index your code
hub / github.com/coder/coder / NewExecer

Function NewExecer

agent/agentexec/exec.go:46–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44}
45
46func NewExecer() (Execer, error) {
47 _, enabled := os.LookupEnv(EnvProcPrioMgmt)
48 if runtime.GOOS != "linux" || !enabled {
49 return DefaultExecer, nil
50 }
51
52 executable, err := os.Executable()
53 if err != nil {
54 return nil, xerrors.Errorf("get executable: %w", err)
55 }
56
57 bin, err := filepath.EvalSymlinks(executable)
58 if err != nil {
59 return nil, xerrors.Errorf("eval symlinks: %w", err)
60 }
61
62 oomScore, ok := envValInt(EnvProcOOMScore)
63 if !ok {
64 oomScore = unset
65 }
66
67 niceScore, ok := envValInt(EnvProcNiceScore)
68 if !ok {
69 niceScore = unset
70 }
71
72 return priorityExecer{
73 binPath: bin,
74 oomScore: oomScore,
75 niceScore: niceScore,
76 }, nil
77}
78
79type execer struct{}
80

Callers 1

workspaceAgentFunction · 0.92

Calls 2

envValIntFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected