diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2022-09-26 17:16:40 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2022-10-02 18:11:16 +0000 |
| commit | 332cb90134bf7ba4f5248147aeee9f8f6a99a579 (patch) | |
| tree | c360749c8f2e5145fed9f6e42912ee7757802407 | |
| parent | main/client: use $PWD for cwd, when $PWD is valid (diff) | |
spawn: set $PWD, in addition to calling chdir(cwd)
| -rw-r--r-- | spawn.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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) { |
