fix(command): prevent failing execvp to return

This commit is contained in:
Ahurac 2024-11-08 11:46:25 +01:00
parent 4f09deb394
commit 16743edb4f

View file

@ -1,5 +1,7 @@
#include "command.h" #include "command.h"
#include <errno.h>
#include <stdlib.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
@ -7,7 +9,7 @@ unsigned char invoke(struct Args args) {
pid_t child = fork(); pid_t child = fork();
if (child == 0) { if (child == 0) {
execvp(args.argv[0], args.argv); execvp(args.argv[0], args.argv);
return 1; exit(errno);
} }
waitpid(child, NULL, 0); waitpid(child, NULL, 0);