Browse Source

Tuer le zombie close #15

master
rick 4 months ago
parent
commit
22ed1c1238
Signed by: Rick GPG Key ID: 2B593F087240EE99
  1. 11
      src/boitoutil/essential_shell.c
  2. 2
      src/boitoutil/essential_shell.h

11
src/boitoutil/essential_shell.c

@ -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');
}
/**

2
src/boitoutil/essential_shell.h

@ -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
Loading…
Cancel
Save