blob: 33ba11cd154abab3a14b3e07a6bf90fef76ab3df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* execute_cmd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/21 13:58:56 by dkaiser #+# #+# */
/* Updated: 2024/10/22 15:42:17 by dkaiser ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
#include <stdlib.h>
#include <sys/_types/_pid_t.h>
#include <unistd.h>
int execute_cmd(t_cmd *cmd, t_env *env)
{
int result;
char *cmd_path;
cmd_path = get_cmd_path(cmd->args[0], env);
cmd->args[0] = cmd_path;
result = execve(cmd->args[0], cmd->args, env_to_strlst(env));
return (result);
}
|