From f3aab6429d673342f4819f8a3c2857e48610689a Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 6 Mar 2020 19:12:10 +0100 Subject: it's going well --- src/ft_warp_level.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/ft_warp_level.c') diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c index 0d126c1..febff7e 100644 --- a/src/ft_warp_level.c +++ b/src/ft_warp_level.c @@ -15,6 +15,9 @@ #include #include #include +#include +#include +#include #include static void @@ -65,13 +68,18 @@ static void { if (isoldmus && !cl->mlist.ismusic) { - /* stop fork() here */ + kill(cl->mpid, SIGTERM); + wait(&cl->mpid); cl->isoldmus = 0; } else if (isoldmus && cl->mlist.ismusic && ft_strncmp(tmp_mup, cl->mlist.music_path, ft_strlen(tmp_mup) + 1)) { - /* stop and recreate fork() here */ + kill(cl->mpid, SIGTERM); + wait(&cl->mpid); + cl->mpid = fork(); + if (cl->mpid == 0) + ft_music_fork(cl->mlist.music_cmd); } else if (isoldmus && cl->mlist.ismusic && !ft_strncmp(tmp_mup, cl->mlist.music_path, ft_strlen(tmp_mup) + 1)) -- cgit v1.2.3