J
Joe Van Dyk
Hi,
I need to start some Ruby programs from a C program. The C program
needs to be able to terminate the Ruby programs when it either exits
or some condition is met.
I tried:
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
int main()
{
system("ruby test.rb");
sleep(5);
if (killpg(0, SIGKILL) =3D=3D -1)
perror("killpg");
printf("main program ending\n");
return 0;
}
Which seems to work fine on a non-ruby program (i.e. another C
program). But the Ruby program (a simple while-true loop that prints
stuff) doesn't exit when the C program does killpg.
Thoughts?
I need to start some Ruby programs from a C program. The C program
needs to be able to terminate the Ruby programs when it either exits
or some condition is met.
I tried:
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
int main()
{
system("ruby test.rb");
sleep(5);
if (killpg(0, SIGKILL) =3D=3D -1)
perror("killpg");
printf("main program ending\n");
return 0;
}
Which seems to work fine on a non-ruby program (i.e. another C
program). But the Ruby program (a simple while-true loop that prints
stuff) doesn't exit when the C program does killpg.
Thoughts?