update: fixed funcheck not finishing due to pid stopping

This commit is contained in:
Maix0 2024-09-11 18:35:40 +02:00
parent d1aea1408a
commit bae0126d8e
3 changed files with 17 additions and 5 deletions

10
.clangd
View file

@ -36,6 +36,16 @@ CompileFlags: # Tweak the parse settings
- "-I/home/maix/school/shcat/output/include/"
- "-I/home/maix/school/shcat/generic_sources/header/"
- "-I/home/maix/school/shcat/exec/src/arith/"
- "-I/home/maix/shcat/vendor/"
- "-I/home/maix/shcat/stdme/include/"
- "-I/home/maix/shcat/allocator/include/"
- "-I/home/maix/shcat/stdme/vendor/"
- "-I/home/maix/shcat/stdme/output/include/"
- "-I/home/maix/shcat/stdme/generic_sources/header/"
- "-I/home/maix/shcat/includes/"
- "-I/home/maix/shcat/output/include/"
- "-I/home/maix/shcat/generic_sources/header/"
- "-I/home/maix/shcat/exec/src/arith/"
- "-I/home/raphael/42/shcat/vendor/"
- "-I/home/raphael/42/shcat/stdme/include/"
- "-I/home/raphael/42/shcat/allocator/include/"

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/11 17:22:29 by maiboyer #+# #+# */
/* Updated: 2024/09/02 13:44:31 by maiboyer ### ########.fr */
/* Updated: 2024/09/11 18:34:27 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -29,6 +29,7 @@
#include "me/vec/vec_pid.h"
#include "me/vec/vec_str.h"
#include "unistd.h"
#include <errno.h>
#include <signal.h>
#include <sys/wait.h>
@ -852,8 +853,9 @@ t_error run_pipeline(t_ast_pipeline *pipeline, t_state *state, t_pipeline_result
}
if (pids.len != 0)
{
while (waitpid(pids.buffer[pids.len - 1], &waitpid_status, 0) < 0)
;
if (!(kill(pids.buffer[pids.len - 1], 0) == -1 && errno == ESRCH))
while (waitpid(pids.buffer[pids.len - 1], &waitpid_status, 0) < 0)
;
while (waitpid(-1, NULL, 0) != -1)
;
if (WIFEXITED(waitpid_status))

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/06 16:31:41 by rparodi #+# #+# */
/* Updated: 2024/09/11 16:39:09 by maiboyer ### ########.fr */
/* Updated: 2024/09/11 18:29:04 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
@ -59,7 +59,7 @@ void exec_shcat(t_state *state)
t_program_result prog_res;
prog_res = (t_program_result){.exit = 0};
print_node_data(&state->current_node, 0);
//print_node_data(&state->current_node, 0);
free_node(state->current_node);
if (state->ast != NULL && run_program(\
&state->ast->data.program, state, &prog_res))