Tuer le zombie close #15

This commit is contained in:
rick 2021-03-05 20:24:28 +01:00
parent 739ef2556a
commit 22ed1c1238
Signed by: Rick
GPG Key ID: 2B593F087240EE99
2 changed files with 6 additions and 7 deletions

View File

@ -15,8 +15,9 @@
#include <errno.h>
//#include <sys/types.h>
#include <signal.h>
#include <sys/wait.h>
pid_t pid;
pid_t pid = 0;
int exit_code = 0;
int need_exit = 0;
@ -114,12 +115,10 @@ void thus_export(char *command[])
setenv(var, val, 1);
}
void ctrl_c_handler()
void ctrl_c_handler(int signum)
{
//kill(pid, SIGTERM);
//kill(pid, SIGKILL);
kill(getpid(), SIGCHLD);
printf("\n");
while (!waitpid(pid, NULL, WNOHANG)) {}
putchar('\n');
}
/**

View File

@ -27,7 +27,7 @@ int native_command(char *command[]);
void change_dir(char *command[]);
void thus_exit(char *command[]);
void thus_export(char *command[]);
void ctrl_c_handler();
void ctrl_c_handler(int signum);
void error(int code, int type, char *message);
#endif