mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
feat: execNoRead
This commit is contained in:
@ -34,6 +34,8 @@ inline int close(FILE* fp, pid_t pid) {
|
||||
|
||||
fclose(fp);
|
||||
do {
|
||||
waitpid(pid, &stat, WCONTINUED | WUNTRACED);
|
||||
|
||||
if (WIFEXITED(stat)) {
|
||||
spdlog::debug("%s exited with code %d", WEXITSTATUS(stat));
|
||||
} else if (WIFSIGNALED(stat)) {
|
||||
@ -83,6 +85,14 @@ inline struct res exec(std::string cmd) {
|
||||
return {WEXITSTATUS(stat), output};
|
||||
}
|
||||
|
||||
inline struct res execNoRead(std::string cmd) {
|
||||
int pid;
|
||||
auto fp = command::open(cmd, pid);
|
||||
if (!fp) return {-1, ""};
|
||||
auto stat = command::close(fp, pid);
|
||||
return {WEXITSTATUS(stat), ""};
|
||||
}
|
||||
|
||||
inline int32_t forkExec(std::string cmd) {
|
||||
if (cmd == "") return -1;
|
||||
|
||||
|
Reference in New Issue
Block a user