spawn: set $PWD, in addition to calling chdir(cwd)

This commit is contained in:
Daniel Eklöf 2022-09-26 19:16:40 +02:00
parent 90ce4f3008
commit 332cb90134
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -54,9 +54,12 @@ spawn(struct reaper *reaper, const char *cwd, char *const argv[],
goto child_err;
}
if (cwd != NULL && chdir(cwd) < 0) {
LOG_WARN("failed to change working directory to %s: %s",
cwd, strerror(errno));
if (cwd != NULL) {
setenv("PWD", cwd, 1);
if (chdir(cwd) < 0) {
LOG_WARN("failed to change working directory to %s: %s",
cwd, strerror(errno));
}
}
if (xdg_activation_token != NULL) {