-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug : #53/선언되지 않은 환경변수 에러 #55
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,7 +6,7 @@ | |
/* By: wonyang <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/01/11 23:33:05 by wonyang #+# #+# */ | ||
/* Updated: 2023/01/14 12:53:27 by wonyang ### ########seoul.kr */ | ||
/* Updated: 2023/01/14 22:34:33 by wonyang ### ########seoul.kr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -34,6 +34,7 @@ static t_error child_execve(t_tnode *node, char *path, char **argv) | |
if (is_builtin_cmd(node) == true) | ||
exit(builtin_execve(builtin, argv, &(g_var.envp), 1)); | ||
execve(path, argv, g_var.envp.arr); | ||
exit(0); | ||
return (ERROR); | ||
} | ||
|
||
|
@@ -50,9 +51,12 @@ static t_error child_execute(t_tnode *cmd_node) | |
ft_freesplit(cmd_argv); | ||
return (ERROR); | ||
} | ||
if (is_builtin_cmd(cmd_node) == false && !path) | ||
if (ft_strcmp(cmd_argv[0], "") == 0 | ||
|| (is_builtin_cmd(cmd_node) == false && !path)) | ||
{ | ||
perror("command not found"); | ||
ft_putstr_fd("bash: ", STDERR_FILENO); | ||
ft_putstr_fd(cmd_argv[0], STDERR_FILENO); | ||
ft_putendl_fd(": command not found", STDERR_FILENO); | ||
exit(127); | ||
} | ||
if (apply_redirections(cmd_node) == ERROR | ||
|
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/11 17:19:11 by wonyang #+# #+# */ | ||
/* Updated: 2023/01/13 15:22:10 by wonyang ### ########seoul.kr */ | ||
/* Updated: 2023/01/14 22:33:47 by wonyang ### ########seoul.kr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -88,7 +88,7 @@ t_error make_cmd_path(char *cmd_name, char **path, char **envp) | |
*path = NULL; | ||
if (access(cmd_name, X_OK) == 0) | ||
{ | ||
*path = cmd_name; | ||
*path = ft_strdup(cmd_name); | ||
return (SCS); | ||
} | ||
path_list = parse_paths(envp); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기에 exit(0)을 추가한 이유가 있나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
로직대로라면 실행될 일이 없겠지만, 이번 이슈 같은 상황을 방지하기 위해 추가했습니다.
무한루프 걸리는 상황보다는 그냥 종료되는게 안전하니까요 😢