diff --git a/ui/build/sandbox_linux.go b/ui/build/sandbox_linux.go index edb3b66d4..ce0d174b9 100644 --- a/ui/build/sandbox_linux.go +++ b/ui/build/sandbox_linux.go @@ -228,6 +228,13 @@ func (c *Cmd) wrapSandbox() { sandboxArgs = append(sandboxArgs, "-N") } + if ccacheExec := os.Getenv("CCACHE_EXEC"); ccacheExec != "" { + bytes, err := exec.Command(ccacheExec, "-k", "cache_dir").Output() + if err == nil { + sandboxArgs = append(sandboxArgs, "-B", strings.TrimSpace(string(bytes))) + } + } + // Stop nsjail from parsing arguments sandboxArgs = append(sandboxArgs, "--")