42_minishell/execution.c
Camille Chauvet 67fb6d0533 -m
2023-02-14 07:26:18 +01:00

35 lines
569 B
C

#include "libftx/libftx.h"
#include "minishell.h"
#include <unistd.h>
int main(int ac, char **av, char **env)
{
}
/* char *ft_get_executable_path(t_data *data, char *executable) */
/* { */
/* if (ft_strcmp(executable, "env") == 0) */
/* return (ft_strjoin("", executable)); */
/* else */
/* return */
/* } */
int ft_excutor(t_cmd *cmd)
{
int pid;
pid = fork();
if (pid == -1)
return (1);
if (pid == 0)
{
dup2(cmd->fd_out, 1);
dup2(cmd->fd_in, 0);
//TODO ADD ENV VARIABLES
execve(cmd->executable, cmd->args, NULL);
}
else
waitpid(pid);
}