works now (in my dreams)
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/28 13:50:14 by tomoron #+# #+# */
|
||||
/* Updated: 2024/04/18 17:56:05 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/04/18 18:29:10 by marde-vr ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -72,6 +72,7 @@ int exec(t_msh *msh, char **cmd_args, int i, int cmd_count)
|
||||
|
||||
if (i != cmd_count - 1)
|
||||
{
|
||||
fprintf(stderr, "piping %d", i);
|
||||
if (pipe(msh->fds[i]) == -1)
|
||||
{
|
||||
perror("minishell: pipe");
|
||||
@ -163,7 +164,7 @@ void exec_commands(t_msh *msh)
|
||||
get_redirections(msh, msh->cmds);
|
||||
fprintf(stderr, "command: %s, in_type: %d, out_type: %d\n", msh->cmds->value, msh->in_type, msh->out_type);
|
||||
exec_command(msh, i, cmd_count);
|
||||
free(msh->fds[i]);
|
||||
//free(msh->fds[i]);
|
||||
i++;
|
||||
}
|
||||
end_execution(msh, cmd_count);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/05 18:15:27 by marde-vr #+# #+# */
|
||||
/* Updated: 2024/04/18 17:56:05 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/04/18 18:25:20 by marde-vr ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -24,7 +24,7 @@ void redirect_input(t_msh *msh, int i)
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "redirecting pipe input\n");
|
||||
fprintf(stderr, "input of cmd %d: 0 -> %d\n", i, msh->fds[i - 1][0]);
|
||||
fprintf(stderr, "input of cmd %d: %d -> 0\n", i, msh->fds[i - 1][0]);
|
||||
if (dup2(msh->fds[i - 1][0], 0) < 0)
|
||||
{
|
||||
perror("dup2"); //debug
|
||||
|
Reference in New Issue
Block a user