in reply to Kill a child nicely
Well, lot's of things to try, but so far no luck. "$live_socket = $socket->accept();" is just blocking any other interaction.
I have found a solution, but it slightly offends me...
In the child:
open(my $swFH, '>', 'sock_waiting') or die "Cannot open sock_waiti +ng for write:$!\n"; close $swFH; my $live_socket = $socket->accept(); unlink('sock_waiting') or die "Cannot unlink sock_waiting:$!\n";
And in the parent:
print "Hit <ENTER> to quit\n"; my $quit = <STDIN>; while(1){ if(-f 'sock_waiting'){ kill 9, $fork_pid; print "User quit\n"; exit; } }
So, essentially, I will kill the child and exit if the child is just waiting for a socket client to connect, but won't while it's busy.
Tom Melly, pm (at) cursingmaggot (stop) co (stop) ukmap{$a=1-$_/10;map{$d=$a;$e=$b=$_/20-2;map{($d,$e)=(2*$d*$e+$a,$e**2 -$d**2+$b);$c=$d**2+$e**2>4?$d=8:_}1..50;print$c}0..59;print$/}0..20
|
|---|