From: Lennart Poettering Date: Thu, 22 Sep 2022 12:21:46 +0000 (+0200) Subject: run: make --working-directory= work for --scope too X-Git-Tag: v252-rc1~109^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fecc44776638a24099ce7e9ac227bcaa2c34f1e0;p=thirdparty%2Fsystemd.git run: make --working-directory= work for --scope too This sounds like a more user-friendly alternative to #24780 --- diff --git a/src/run/run.c b/src/run/run.c index e2915fe4def..627a6b11dab 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -1529,6 +1529,9 @@ static int start_transient_scope(sd_bus *bus) { return log_error_errno(errno, "Failed to change UID to " UID_FMT ": %m", uid); } + if (arg_working_directory && chdir(arg_working_directory) < 0) + return log_error_errno(errno, "Failed to change directory to '%s': %m", arg_working_directory); + env = strv_env_merge(environ, user_env, arg_environment); if (!env) return log_oom();