Browse Source

fix: pipe on built-ins

master
narnaud 3 years ago
parent
commit
0ec79cf679
  1. 4
      Makefile
  2. 4
      minishell.c

4
Makefile

@ -3,8 +3,8 @@ LIBFT = libft.a
SRCS = minishell.c lexer.c parser.c utils.c caller.c built-in.c env.c
OBJS = ${SRCS:.c=.o}
//READLINE_INC = ~/.brew/opt/readline/include
//LIB = -L ~/.brew/lib -lreadline -L ~/.brew/lib -lhistory -L. -lft
#READLINE_INC = ~/.brew/opt/readline/include
#LIB = -L ~/.brew/lib -lreadline -L ~/.brew/lib -lhistory -L. -lft
LIB = -lreadline -lhistory -L. -lft

4
minishell.c

@ -28,15 +28,13 @@ int caller(t_command *cmd)
}
pid = fork();
if (!pid)
{
if (command_call(cmd->argv) == -1)
{
if (cmd->fd[0])
dup2(cmd->fd[0], STDIN_FILENO);
if (cmd->fd[1])
dup2(cmd->fd[1], STDOUT_FILENO);
if (command_call(cmd->argv) == -1)
exe(cmd->argv, cmd->envp);
}
exit(1);
}
if (cmd->fd[1])

Loading…
Cancel
Save