Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/lib-sudo.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / lib-sudo.sh` 15 lines ยท 476 bytes Raw Blame History 1 # Helpers for running git commands under sudo. 2 3 # Runs a scriplet passed through stdin under sudo. 4 run_with_sudo () { 5 local ret 6 local RUN="$TEST_DIRECTORY/$$.sh" 7 write_script "$RUN" "$TEST_SHELL_PATH" 8 # avoid calling "$RUN" directly so sudo doesn't get a chance to 9 # override the shell, add additional restrictions or even reject 10 # running the script because its security policy deem it unsafe 11 sudo "$TEST_SHELL_PATH" -c "\"$RUN\"" 12 ret=$? 13 rm -f "$RUN" 14 return $ret 15 }