ref: 132961ec4787e48cd1ef08814211fab981f988c4
parent: 6b73a1db16534e4a4f6d6c2565a680668b2c210f
author: Noam Preil <noam@pixelhero.dev>
date: Fri Dec 12 05:07:43 EST 2025
system: report status
--- a/libnpe/system.c
+++ b/libnpe/system.c
@@ -5,7 +5,8 @@
int
system(char *s)
{- int w, status;
+ int status;
+ Waitmsg *w;
pid_t pid;
char cmd[30], *oty;
@@ -24,12 +25,15 @@
return -1;
}
for(;;){- w = waitpid();
- if(w == -1 || w == pid)
+ w = wait();
+ if(w == nil || w->pid == pid)
break;
}
- if(w == -1)
- return w;
+ status = -1;
+ if(w != nil){+ status = w->msg[0] != 0;
+ free(w);
+ }
return status;
}
--
⑨