optimizations

This commit is contained in:
Night Kaly 2024-02-06 18:58:47 +00:00
parent 8aea8a33a4
commit d9f5d29dda
No known key found for this signature in database
GPG key ID: 8E829D3381CFEBBE

View file

@ -164,10 +164,8 @@ int execute(char **args) {
} }
} }
pid_t pid, wpid; pid_t pid = fork();
int status; int status;
pid = fork();
if (pid == 0) { if (pid == 0) {
// Child process // Child process
if (execvp(args[0], args) == -1) { if (execvp(args[0], args) == -1) {
@ -181,7 +179,7 @@ int execute(char **args) {
} else { } else {
// Parent process // Parent process
while (!WIFEXITED(status) && !WIFSIGNALED(status)) { while (!WIFEXITED(status) && !WIFSIGNALED(status)) {
wpid = waitpid(pid, &status, WUNTRACED); // wait child to be exited to return to prompt waitpid(pid, &status, WUNTRACED); // wait child to be exited to return to prompt
} }
} }