Tuer le zombie close #15
This commit is contained in:
parent
739ef2556a
commit
22ed1c1238
2 changed files with 6 additions and 7 deletions
|
@ -15,8 +15,9 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
//#include <sys/types.h>
|
//#include <sys/types.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
|
||||||
pid_t pid;
|
pid_t pid = 0;
|
||||||
int exit_code = 0;
|
int exit_code = 0;
|
||||||
int need_exit = 0;
|
int need_exit = 0;
|
||||||
|
|
||||||
|
@ -114,12 +115,10 @@ void thus_export(char *command[])
|
||||||
setenv(var, val, 1);
|
setenv(var, val, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctrl_c_handler()
|
void ctrl_c_handler(int signum)
|
||||||
{
|
{
|
||||||
//kill(pid, SIGTERM);
|
while (!waitpid(pid, NULL, WNOHANG)) {}
|
||||||
//kill(pid, SIGKILL);
|
putchar('\n');
|
||||||
kill(getpid(), SIGCHLD);
|
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,7 +27,7 @@ int native_command(char *command[]);
|
||||||
void change_dir(char *command[]);
|
void change_dir(char *command[]);
|
||||||
void thus_exit(char *command[]);
|
void thus_exit(char *command[]);
|
||||||
void thus_export(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);
|
void error(int code, int type, char *message);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue