mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-07 08:21:02 -04:00
spawn: don’t error out if we fail to chdir()
This commit is contained in:
parent
064121ee95
commit
ac30da7a01
2 changed files with 7 additions and 1 deletions
|
|
@ -76,6 +76,8 @@
|
||||||
now translated to pixel values using the monitor’s scaling factor
|
now translated to pixel values using the monitor’s scaling factor
|
||||||
when `dpi-aware=no`, or `dpi-aware=auto` and the scaling factor is
|
when `dpi-aware=no`, or `dpi-aware=auto` and the scaling factor is
|
||||||
larger than 1 (https://codeberg.org/dnkl/foot/issues/680).
|
larger than 1 (https://codeberg.org/dnkl/foot/issues/680).
|
||||||
|
* Spawning a new terminal with a working directory that does not exist
|
||||||
|
is no longer a fatal error.
|
||||||
|
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
|
||||||
6
spawn.c
6
spawn.c
|
|
@ -48,6 +48,11 @@ spawn(struct reaper *reaper, const char *cwd, char *const argv[],
|
||||||
if (sigaction(SIGHUP, &(struct sigaction){.sa_handler = SIG_DFL}, NULL) < 0)
|
if (sigaction(SIGHUP, &(struct sigaction){.sa_handler = SIG_DFL}, NULL) < 0)
|
||||||
goto child_err;
|
goto child_err;
|
||||||
|
|
||||||
|
if (cwd != NULL && chdir(cwd) < 0) {
|
||||||
|
LOG_WARN("failed to change working directory to %s: %s",
|
||||||
|
cwd, strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
bool close_stderr = stderr_fd >= 0;
|
bool close_stderr = stderr_fd >= 0;
|
||||||
bool close_stdout = stdout_fd >= 0 && stdout_fd != stderr_fd;
|
bool close_stdout = stdout_fd >= 0 && stdout_fd != stderr_fd;
|
||||||
bool close_stdin = stdin_fd >= 0 && stdin_fd != stdout_fd && stdin_fd != stderr_fd;
|
bool close_stdin = stdin_fd >= 0 && stdin_fd != stdout_fd && stdin_fd != stderr_fd;
|
||||||
|
|
@ -58,7 +63,6 @@ spawn(struct reaper *reaper, const char *cwd, char *const argv[],
|
||||||
|| (close_stdout && close(stdout_fd) < 0))) ||
|
|| (close_stdout && close(stdout_fd) < 0))) ||
|
||||||
(stderr_fd >= 0 && (dup2(stderr_fd, STDERR_FILENO) < 0
|
(stderr_fd >= 0 && (dup2(stderr_fd, STDERR_FILENO) < 0
|
||||||
|| (close_stderr && close(stderr_fd) < 0))) ||
|
|| (close_stderr && close(stderr_fd) < 0))) ||
|
||||||
(cwd != NULL && chdir(cwd) < 0) ||
|
|
||||||
execvp(argv[0], argv) < 0)
|
execvp(argv[0], argv) < 0)
|
||||||
{
|
{
|
||||||
goto child_err;
|
goto child_err;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue