aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/go_exec.go
blob: 883350520f6e2303a6112b36352ea01b44a2205d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright 2020 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//go:build !libc_exec
// +build !libc_exec

package main

import (
	"os/exec"
	"syscall"
)

// Implement exec for users that don't need to dynamically link with glibc
// See b/144783188 and libc_exec.go.

func execCmd(env env, cmd *command) error {
	execCmd := exec.Command(cmd.Path, cmd.Args...)
	mergedEnv := mergeEnvValues(env.environ(), cmd.EnvUpdates)

	ret := syscall.Exec(execCmd.Path, execCmd.Args, mergedEnv)
	return newErrorwithSourceLocf("exec error: %v", ret)
}