|
@@ -124,11 +124,11 @@ int main(int argc, char* argv[], char* envp[]) {
|
|
|
//Boucle infini de lecture
|
|
|
while(!exitsh){
|
|
|
//On regarde si un fils en fond est mort
|
|
|
- if(sigpending(&sigs_block) == ERR){
|
|
|
- addperror("Impossible de recuperer les signaux en attentes");
|
|
|
- } else if(sigismember(&sigs_block, SIGCHLD)){
|
|
|
- job--;
|
|
|
- }
|
|
|
+ if(sigpending(&sigs_block) == ERR){
|
|
|
+ addperror("Impossible de recuperer les signaux en attentes");
|
|
|
+ } else if(sigismember(&sigs_block, SIGCHLD)){
|
|
|
+ job--;
|
|
|
+ }
|
|
|
//Affichage repertoire
|
|
|
show_current_dir(before, ">\x1b[0m ");
|
|
|
//Lecture ligne
|
|
@@ -144,7 +144,6 @@ int main(int argc, char* argv[], char* envp[]) {
|
|
|
continue;
|
|
|
}
|
|
|
//Si aucune commande on passe
|
|
|
- printf("Nb cmd : %d\n", ct.length);
|
|
|
if(ct.length == 0){
|
|
|
clean_command(&ct);
|
|
|
continue;
|
|
@@ -158,7 +157,6 @@ int main(int argc, char* argv[], char* envp[]) {
|
|
|
}
|
|
|
//Execute
|
|
|
result_cmd = run(ct, &status_cmd);
|
|
|
- printf("Result : %d\n", result_cmd);
|
|
|
//Vide le resultat du parse de la ligne de commande
|
|
|
clean_command(&ct);
|
|
|
}
|
|
@@ -175,7 +173,6 @@ int run(CommandTab ct, int* status){
|
|
|
pid_t pid;
|
|
|
int result = 0;
|
|
|
//Si en fond creation d'un fork pour executer les commandes
|
|
|
- printf("bck : %d\n", ct.bck);
|
|
|
if(ct.bck){
|
|
|
pid = fork();
|
|
|
if(pid == ERR){
|
|
@@ -330,7 +327,6 @@ void handler(int sig){
|
|
|
//Repositionne le gestionnaire (Ne marche plus apres 1 utilisation)
|
|
|
signal(SIGINT, handler);
|
|
|
//Si il y a un process actif on le coupe
|
|
|
- printf("Active : %d\n", active);
|
|
|
if(active != -1){
|
|
|
if(kill(active, SIGINT) == ERR){
|
|
|
addperror("Impossible de tuer le processus en cours");
|