For c3c run and friends, pass SIGINT to child process on Linux (#2480)

This commit is contained in:
m0tholith
2025-09-13 19:51:33 +03:00
committed by GitHub
parent 8fea6ee8ab
commit 2e99ae5ab9

View File

@@ -5,6 +5,8 @@
#if PLATFORM_POSIX
#include <sys/wait.h>
pid_t cpid;
#endif
#if PLATFORM_WINDOWS
@@ -12,6 +14,13 @@
#include <windows.h>
#endif
#if defined(__linux__)
void signal_to_subprocess(int sig)
{
kill(cpid, sig);
}
#endif
int run_subprocess(const char *name, const char **args)
{
#if PLATFORM_WINDOWS
@@ -105,7 +114,7 @@ int run_subprocess(const char *name, const char **args)
return exit_status;
#else
pid_t cpid = fork();
cpid = fork();
if (cpid < 0)
{
eprintf("Could not fork child process %s: %s\n", name, strerror(errno));
@@ -129,6 +138,9 @@ int run_subprocess(const char *name, const char **args)
exit(0);
}
#if defined(__linux__)
signal(SIGINT, signal_to_subprocess);
#endif
for (;;)
{
int wstatus = 0;