xref: /aosp_15_r20/external/toolchain-utils/compiler_wrapper/go_exec.go (revision 760c253c1ed00ce9abd48f8546f08516e57485fe)
1// Copyright 2020 The ChromiumOS Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5//go:build !libc_exec
6// +build !libc_exec
7
8package main
9
10import (
11	"os/exec"
12	"syscall"
13)
14
15// Implement exec for users that don't need to dynamically link with glibc
16// See b/144783188 and libc_exec.go.
17
18func execCmd(env env, cmd *command) error {
19	execCmd := exec.Command(cmd.Path, cmd.Args...)
20	mergedEnv := mergeEnvValues(env.environ(), cmd.EnvUpdates)
21
22	ret := syscall.Exec(execCmd.Path, execCmd.Args, mergedEnv)
23	return newErrorwithSourceLocf("exec error: %v", ret)
24}
25