my $prg='"c:/winnt/notepad.exe"'; #CONSOLE WINDOWS IS NOT CLOSED
my $prg='c:/winnt/notepad.exe'; #CONSOLE WINDOWS IS CLOSED
####
my $prg='"c:/winnt/notepad.exe"'; #CONSOLE WINDOWS IS NOT CLOSED
#my $prg='c:/winnt/notepad.exe'; #CONSOLE WINDOWS IS CLOSED
if ($pid = fork)
{ #PARENT-process
sleep 5; #WAIT FOR CHILD TO START $prg
$killresult=kill 'STOP',$pid; #KILL CHILD
print "\nKillresult:$killresult";
}
elsif (defined $pid)
{ #CHILD
exec $prg;
exit(0);
}
print "\nKill self (parent, that is) to close CONSOLE window";
kill 'STOP',$$;
exit(0);
##
##
sub REAPER
{
$waitedpid=wait;
print "\nKilled $waitepid";
$SIG{'CHLD'}=\&REAPER;
}
$SIG{'CHLD'}=\&REAPER;