1

c++: fall back to cache dir in /tmp

rules_go is making calls that do `env - <...>` and are setting neither
TMPDIR nor HOME. So we should always fallback somewhere.
This commit is contained in:
Motiejus Jakštys 2022-08-12 09:25:37 +03:00
parent aaa50aad6d
commit db7beefbe4

View File

@ -80,12 +80,15 @@ ZIG_TOOL_WRAPPER = """#!/usr/bin/env bash
set -e set -e
if [[ -n "$TMPDIR" ]]; then if [[ -n "$TMPDIR" ]]; then
_cache_prefix=$TMPDIR _cache_prefix=$TMPDIR
elif [[ -n "$HOME" ]]; then
if [[ "$(uname)" = Darwin ]]; then
_cache_prefix="$HOME/Library/Caches"
else
_cache_prefix="$HOME/.cache"
fi
else else
_cache_prefix="$HOME/.cache" _cache_prefix=/tmp
if [[ "$(uname)" = Darwin ]]; then
_cache_prefix="$HOME/Library/Caches"
fi
fi fi
export ZIG_LOCAL_CACHE_DIR="$_cache_prefix/bazel-zig-cc" export ZIG_LOCAL_CACHE_DIR="$_cache_prefix/bazel-zig-cc"