Mercurial > xbps-search-tv
diff spawn.cpp @ 2:00b62a080354
fix numerous bugs
| author | Yasuri <yasuri@charliesmp.net> |
|---|---|
| date | Sun, 13 Sep 2026 19:40:11 +0000 |
| parents | 21b543c7aa14 |
| children |
line wrap: on
line diff
--- a/spawn.cpp Sun Sep 13 19:25:50 2026 +0000 +++ b/spawn.cpp Sun Sep 13 19:40:11 2026 +0000 @@ -6,13 +6,13 @@ #include <string> #include "process.h" extern char** environ; // idk what this does -std::string spawn(char* const argv[], const char* path) +std::string spawn(char* const argv[]) { pid_t pid; int status; - status = posix_spawn(&pid, path, NULL, NULL, const_cast<char* const*>(argv), environ); + status = posix_spawnp(&pid, argv[0], NULL, NULL, const_cast<char* const*>(argv), environ); if (status != 0) { - std::cerr << "posix_spawn failed:" << strerror(status) << std::endl; + std::cerr << "posix_spawnp failed for " << argv[0] << ": " << strerror(status) << std::endl; return "error"; } if (waitpid(pid, &status, 0) == -1) { @@ -23,7 +23,7 @@ return std::to_string(WEXITSTATUS(status)); } if (WIFSIGNALED(status)) { - return std::to_string(WTERMSIG(status)); + return "sig:" + std::to_string(WTERMSIG(status)); } return "success"; }
