aboutsummaryrefslogtreecommitdiffstats
path: root/client/go/internal/admin/prog/run.go
blob: 7dafbad1446e46daa5532193ec6c05a2baad994b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// Author: arnej

package prog

import (
	"github.com/vespa-engine/vespa/client/go/internal/admin/envvars"
	"github.com/vespa-engine/vespa/client/go/internal/util"
)

func (spec *Spec) Run() error {
	prog := spec.Program
	args := spec.Args
	if spec.shouldUseValgrind {
		args = spec.prependValgrind(args)
		prog = args[0]
	} else if spec.shouldUseNumaCtl {
		args = spec.prependNumaCtl(args)
		prog = args[0]
	}
	if spec.shouldUseVespaMalloc {
		spec.Setenv(envvars.LD_PRELOAD, spec.vespaMallocPreload)
	}
	envv := spec.EffectiveEnv()
	return util.Execvpe(prog, args, envv)
}