Skip to content

Commit

Permalink
helpers2.1: turns out sudo --preserve-env=PATH still causes issues wi…
Browse files Browse the repository at this point in the history
…th 'command not found' despite the command being in the path and 'which' finding the proper executable ... using 'env PATH=$PATH' instead fixes the issue ...
  • Loading branch information
alexAubin committed Sep 6, 2024
1 parent a5049a8 commit 589fda2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions helpers/helpers.v2.1.d/utils
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ fi

# Execute a command after sudoing as $app
#
# Note that the $PATH variable is preserved (using --preserve-env=PATH)
# Note that the $PATH variable is preserved (using env PATH=$PATH)
#
# usage: ynh_exec_as_app COMMAND [ARG ...]
ynh_exec_as_app() {
sudo --preserve-env=PATH -u "$app" "$@"
sudo -u "$app" env PATH="$PATH" "$@"
}

# Curl abstraction to help with POST requests to local pages (such as installation forms)
Expand Down

0 comments on commit 589fda2

Please sign in to comment.