-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Bug : #46/부모 프로세스 시그널 핸들링
- Loading branch information
Showing
4 changed files
with
10 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,13 +6,14 @@ | |
/* By: wonyang <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/01/11 23:33:05 by wonyang #+# #+# */ | ||
/* Updated: 2023/01/14 22:34:33 by wonyang ### ########seoul.kr */ | ||
/* Updated: 2023/01/15 11:46:51 by wonyang ### ########seoul.kr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include <stdio.h> | ||
#include <unistd.h> | ||
#include <stdlib.h> | ||
#include <signal.h> | ||
#include "minishell.h" | ||
#include "ds_envp.h" | ||
#include "execute.h" | ||
|
@@ -123,6 +124,7 @@ t_error create_childs(t_tnode **cmd_list, pid_t *pid_list) | |
|
||
before_fd = STDIN_FILENO; | ||
i = 0; | ||
signal(SIGINT, SIG_IGN); | ||
while (cmd_list[i + 1]) | ||
{ | ||
pid_list[i] = fork_child(cmd_list[i], &before_fd); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: wonyang <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/01/10 19:35:48 by wonyang #+# #+# */ | ||
/* Updated: 2023/01/13 17:17:47 by wonyang ### ########seoul.kr */ | ||
/* Updated: 2023/01/15 11:45:51 by wonyang ### ########seoul.kr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -25,6 +25,7 @@ typedef struct s_global | |
int status; | ||
} t_global; | ||
|
||
void set_signal_handling(void); | ||
void set_minishell_setting(void); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: wonyang <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/01/08 22:30:32 by wonyang #+# #+# */ | ||
/* Updated: 2023/01/14 22:47:58 by wonyang ### ########seoul.kr */ | ||
/* Updated: 2023/01/15 11:46:01 by wonyang ### ########seoul.kr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -92,6 +92,7 @@ int main(int argc, char **argv, char **env) | |
else | ||
execute_cmds(node); | ||
tcsetattr(STDIN_FILENO, TCSANOW, &(g_var.new_term)); | ||
set_signal_handling(); | ||
ft_lstclear(&lst, del_t_paren); | ||
clear_node(node, del_t_token); | ||
free(str); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: wonyang <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/01/10 15:47:32 by wonyang #+# #+# */ | ||
/* Updated: 2023/01/13 17:17:56 by wonyang ### ########seoul.kr */ | ||
/* Updated: 2023/01/15 11:49:27 by wonyang ### ########seoul.kr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -32,13 +32,14 @@ static void get_terminal_setting(void) | |
static void sigint_handler_prompt(int signo) | ||
{ | ||
(void)signo; | ||
g_var.status = 1; | ||
ft_putchar_fd('\n', STDOUT_FILENO); | ||
rl_on_new_line(); | ||
rl_replace_line("", 0); | ||
rl_redisplay(); | ||
} | ||
|
||
static void set_signal_handling(void) | ||
void set_signal_handling(void) | ||
{ | ||
signal(SIGINT, sigint_handler_prompt); | ||
} | ||
|