Fixed stuff
This commit is contained in:
parent
be1d3ff2d3
commit
f4e8596f3b
15 changed files with 130 additions and 103 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/09 15:00:53 by rparodi #+# #+# */
|
||||
/* Updated: 2024/05/18 16:54:29 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/05/18 18:31:34 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -28,7 +28,8 @@ t_error handle_command(t_node *self, t_utils *shcat, t_i32 *out_exit_code)
|
|||
t_spawn_info spawn_info;
|
||||
t_str tmp;
|
||||
|
||||
spawn_info.arguments = vec_str_new(64, (void (*)(t_str))mem_free); // TODO: FIX VECTOR
|
||||
spawn_info.arguments =
|
||||
vec_str_new(64, (void (*)(t_str))mem_free); // TODO: FIX VECTOR
|
||||
if (self->kind != sym_command)
|
||||
return (ERROR);
|
||||
i = 0;
|
||||
|
|
@ -37,7 +38,8 @@ t_error handle_command(t_node *self, t_utils *shcat, t_i32 *out_exit_code)
|
|||
if (self->childs[i].kind == sym_command_name)
|
||||
{
|
||||
spawn_info.binary_path = str_clone(node_getstr(&self->childs[i]));
|
||||
vec_str_push(&spawn_info.arguments, str_clone(spawn_info.binary_path));
|
||||
vec_str_push(&spawn_info.arguments,
|
||||
str_clone(spawn_info.binary_path));
|
||||
printf("%s\n", spawn_info.arguments.buffer[0]);
|
||||
}
|
||||
else if (self->childs[i].kind == sym_file_redirect)
|
||||
|
|
@ -55,14 +57,15 @@ t_error handle_command(t_node *self, t_utils *shcat, t_i32 *out_exit_code)
|
|||
}
|
||||
i++;
|
||||
}
|
||||
printf("%zu\n", spawn_info.arguments.len);
|
||||
// printf("%zu\n", spawn_info.arguments.len);
|
||||
vec_str_push(&spawn_info.arguments, NULL);
|
||||
for (i = 0; i < spawn_info.arguments.len; i++)
|
||||
printf("[%zu]\t%s\n", i, spawn_info.arguments.buffer[i]);
|
||||
// for (i = 0; i < spawn_info.arguments.len; i++)
|
||||
// printf("[%zu]\t%s\n", i, spawn_info.arguments.buffer[i]);
|
||||
spawn_info.stdin = inherited();
|
||||
spawn_info.stdout = inherited();
|
||||
spawn_info.stderr = inherited();
|
||||
spawn_info.forked_free = NULL;
|
||||
printf("building envp\n");
|
||||
if (build_envp(shcat->env, &spawn_info.environement))
|
||||
return (vec_str_free(spawn_info.arguments), ERROR);
|
||||
if (spawn_process(spawn_info, &shcat->ret))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue