optimizations
This commit is contained in:
parent
8aea8a33a4
commit
d9f5d29dda
1 changed files with 2 additions and 4 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue