L
lekonna
Hi guys,
i'm having a bit of a problem here with the exec functionality. I seem
to be unable to kill the children of my process. Hope you can help me
with this one.
I'm doing a client-server setup where the server requests the clients
to start instances of a certain application and now the bugger doesn't
seem to die properly. The code in nutshell is here, i'll eliminate my
crappy message handling and just quote the handler funcs:
<start block>
$pid = fork;
if ( $pid == 0 )
{
exec( $my_command,$my_args) or die "can't do it Jim!";
} else {
$jobs{$pid} = $my_args;
}
</start block>
<kill block>
foreach ( keys( $jobs ) )
{
kill 9,$_;
}
delete %jobs;
</kill block>
What happens is that the exec starts the program properly and returns
a pid. the kill however seems to be unable
to do anything to the program that is executed, it just keeps
running.
Am i actually execing a command shell instance that then starts the
program as child and my kill hangs there?
At the moment coding in Win32 environment but the code should port to
linux/osX as well.
Br,
Lekonna
i'm having a bit of a problem here with the exec functionality. I seem
to be unable to kill the children of my process. Hope you can help me
with this one.
I'm doing a client-server setup where the server requests the clients
to start instances of a certain application and now the bugger doesn't
seem to die properly. The code in nutshell is here, i'll eliminate my
crappy message handling and just quote the handler funcs:
<start block>
$pid = fork;
if ( $pid == 0 )
{
exec( $my_command,$my_args) or die "can't do it Jim!";
} else {
$jobs{$pid} = $my_args;
}
</start block>
<kill block>
foreach ( keys( $jobs ) )
{
kill 9,$_;
}
delete %jobs;
</kill block>
What happens is that the exec starts the program properly and returns
a pid. the kill however seems to be unable
to do anything to the program that is executed, it just keeps
running.
Am i actually execing a command shell instance that then starts the
program as child and my kill hangs there?
At the moment coding in Win32 environment but the code should port to
linux/osX as well.
Br,
Lekonna