exec.sh 505 B

12345678910111213141516
  1. #!/usr/bin/env bash
  2. #
  3. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  4. # Exceptions. See /LICENSE for license information.
  5. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. # Turn any pwd-relative files into absolute paths. Other args may be
  7. # BUILD_WORKING_DIRECTORY-relative, which will be handled by the executed
  8. # binary.
  9. ARGS=("$@")
  10. for i in "${!ARGS[@]}"; do
  11. if [[ -e "${ARGS[$i]}" ]]; then
  12. ARGS[$i]="$(realpath ${ARGS[$i]})"
  13. fi
  14. done
  15. exec "${ARGS[@]}"