From 589fda20b215c26023a21ecae0ee5023f32b9157 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 6 Sep 2024 22:13:06 +0200 Subject: [PATCH] helpers2.1: turns out sudo --preserve-env=PATH still causes issues with 'command not found' despite the command being in the path and 'which' finding the proper executable ... using 'env PATH=$PATH' instead fixes the issue ... --- helpers/helpers.v2.1.d/utils | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helpers/helpers.v2.1.d/utils b/helpers/helpers.v2.1.d/utils index bda5391cdf..59c5ff62a8 100644 --- a/helpers/helpers.v2.1.d/utils +++ b/helpers/helpers.v2.1.d/utils @@ -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)