From 25a8e2f65ea31c98041affdda8addb26700cda58 Mon Sep 17 00:00:00 2001 From: Jack Halford Date: Sun, 5 Mar 2017 18:15:09 +0100 Subject: [PATCH] getoutput temporary fix --- 42sh/src/exec/launch_process.c | 7 ++++--- 42sh/src/exec/process_setexec.c | 2 +- 42sh/src/glob/command_getoutput.c | 4 ++-- 42sh/src/main/shell_get_opts.c | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/42sh/src/exec/launch_process.c b/42sh/src/exec/launch_process.c index 6aa02d84..8dd68e79 100644 --- a/42sh/src/exec/launch_process.c +++ b/42sh/src/exec/launch_process.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */ -/* Updated: 2017/03/05 16:32:22 by jhalford ### ########.fr */ +/* Updated: 2017/03/05 18:08:57 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -45,11 +45,12 @@ int launch_process(t_process *p) } process_setgroup(p, 0); process_setsig(); - DG("gonna redirect"); if (process_redirect(p)) exit (1); + if (p->attributes & PROCESS_BUILTIN) + exit((*p->execf)(p->path, p->av, data_singleton()->env)); (*p->execf)(p->path, p->av, data_singleton()->env); - ft_dprintf(2, "{red}%s: internal excve error{eoc}\n", SHELL_NAME); + ft_dprintf(2, "{red}%s: internal execve error on %s{eoc}\n", SHELL_NAME, p->av[0]); } else if (pid > 0) { diff --git a/42sh/src/exec/process_setexec.c b/42sh/src/exec/process_setexec.c index 4f74a7be..89be21a8 100644 --- a/42sh/src/exec/process_setexec.c +++ b/42sh/src/exec/process_setexec.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 17:07:10 by jhalford #+# #+# */ -/* Updated: 2017/03/03 16:32:15 by jhalford ### ########.fr */ +/* Updated: 2017/03/05 18:09:31 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/glob/command_getoutput.c b/42sh/src/glob/command_getoutput.c index 30cbc11f..4949cd86 100644 --- a/42sh/src/glob/command_getoutput.c +++ b/42sh/src/glob/command_getoutput.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/12 14:01:59 by jhalford #+# #+# */ -/* Updated: 2017/03/03 16:45:40 by jhalford ### ########.fr */ +/* Updated: 2017/03/05 18:07:24 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,7 +15,7 @@ char *command_getoutput(char *command) { - return (command); + return (ft_strdup(command)); /* int fds[2]; */ /* t_btree *ast; */ /* t_astnode item; */ diff --git a/42sh/src/main/shell_get_opts.c b/42sh/src/main/shell_get_opts.c index 2b03c6ae..0eee3eb4 100644 --- a/42sh/src/main/shell_get_opts.c +++ b/42sh/src/main/shell_get_opts.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/11 14:04:48 by jhalford #+# #+# */ -/* Updated: 2017/03/05 17:09:22 by jhalford ### ########.fr */ +/* Updated: 2017/03/05 17:45:37 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */