xref: /aosp_15_r20/external/bazelbuild-rules_rust/util/process_wrapper/private/process_wrapper.sh (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1#!/usr/bin/env bash
2
3set -euo pipefail
4
5# Skip the first argument which is expected to be `--`
6shift
7
8args=()
9
10for arg in "$@"; do
11    # Check if the argument contains "${PWD}" and replace it with the actual value of PWD
12    if [[ "${arg}" == *'${pwd}'* ]]; then
13        arg="${arg//\$\{pwd\}/$PWD}"
14    fi
15    args+=("${arg}")
16done
17
18exec "${args[@]}"
19