spawn(): search $PATH as well

makes this function more useful for other people writing patches such as
this: https://codeberg.org/nsxiv/nsxiv-extra/src/branch/master/patches/dmenu-search
This commit is contained in:
NRK 2022-10-28 23:17:06 +06:00
parent 49d11f0d1f
commit 16b966be3b

2
util.c
View File

@ -268,7 +268,7 @@ pid_t spawn(int *readfd, int *writefd, char *const argv[])
if (writefd != NULL && mkspawn_pipe(&fa, cmd, pfd_write, 0) < 0) if (writefd != NULL && mkspawn_pipe(&fa, cmd, pfd_write, 0) < 0)
goto err_close_readfd; goto err_close_readfd;
if ((err = posix_spawn(&pid, cmd, &fa, NULL, argv, environ)) != 0) { if ((err = posix_spawnp(&pid, cmd, &fa, NULL, argv, environ)) != 0) {
error(0, err, "spawn: %s", cmd); error(0, err, "spawn: %s", cmd);
} else { } else {
if (readfd != NULL) if (readfd != NULL)