MCPcopy Index your code
hub / github.com/jetify-com/devbox / run

Method run

internal/patchpkg/patch.go:165–188  ·  view source on GitHub ↗

run runs patchelf on an ELF binary and returns its output.

(ctx context.Context, elf string)

Source from the content-addressed store, hash-verified

163
164// run runs patchelf on an ELF binary and returns its output.
165func (p *patchelf) run(ctx context.Context, elf string) ([]byte, error) {
166 cmd := exec.CommandContext(ctx, lookPath("patchelf"))
167 if len(p.SetRPATH) != 0 {
168 cmd.Args = append(cmd.Args, "--force-rpath", "--set-rpath", strings.Join(p.SetRPATH, ":"))
169 }
170 if p.PrintRPATH {
171 cmd.Args = append(cmd.Args, "--print-rpath")
172 }
173 if p.SetInterpreter != "" {
174 cmd.Args = append(cmd.Args, "--set-interpreter", p.SetInterpreter)
175 }
176 if p.PrintInterpreter {
177 cmd.Args = append(cmd.Args, "--print-interpreter")
178 }
179 for _, needed := range p.AddNeeded {
180 cmd.Args = append(cmd.Args, "--add-needed", needed)
181 }
182 if p.Output != "" {
183 cmd.Args = append(cmd.Args, "--output", p.Output)
184 }
185 cmd.Args = append(cmd.Args, elf)
186 out, err := cmd.Output()
187 return bytes.TrimSpace(out), err
188}

Callers 1

patchMethod · 0.95

Calls 2

lookPathFunction · 0.85
OutputMethod · 0.45

Tested by

no test coverage detected