Procházet zdrojové kódy

Refonte gestion signeaux proc background

Loquicom před 6 roky
rodič
revize
df5c933a4c
2 změnil soubory, kde provedl 4 přidání a 8 odebrání
  1. 3 8
      mysh.c
  2. 1 0
      mysh.h

+ 3 - 8
mysh.c

@@ -29,10 +29,7 @@ extern pid_t active;
 int status_cmd = -1;
 int result_cmd = -1;
 char base_path[BUFFER_SIZE];
-
-/* --- Global --- */
 pid_list pidlist;
-boolean fond = false;
 
 int job = 1;
 
@@ -257,7 +254,9 @@ int run(CommandTab ct, int* status){
         if(pid == 0){
             int stat = 0;
             ct.bck = 0;
-            fond = true;
+            //Ignore les sigint
+            signal(SIGINT, SIG_IGN);
+            //Lance commande
             result = run(ct, &stat);
             //Message de fin + retour
             if(result == SHELL_FAIL){
@@ -397,10 +396,6 @@ void handler(int sig){
     pid_node* pn;
     //Repositionne le gestionnaire (Ne marche plus apres 1 utilisation)
     signal(SIGINT, handler);
-    //Si on est en fond on est non concerné
-    if(fond){
-        return;
-    }
     //Si il y a un process actif on le coupe
     printf("Active : %d\n", active);
     if(active != -1){

+ 1 - 0
mysh.h

@@ -12,6 +12,7 @@
 extern int status_cmd;
 extern int result_cmd;
 extern char base_path[];
+extern pid_list pidlist;
 
 /* --- Fonctions --- */
 /**