kmitchner has asked for the wisdom of the Perl Monks concerning the following question:

I am working on a postback script that is having some weird problems trying to kill a firefox instance that is being loaded. Essentially what I need is to be able to have a non-blocking child thread running firefox that I can kill from it's parent thread to restart it, that I can push tabs to from a loop. But I can't get firefox to stop ghosting when I spawn it. Here is a short example of what I am trying to do:
#!/usr/bin/perl # Test my $pid = run_in_bg(); sleep 5; system("firefox","-remote","openURL(http://www.google.com,new-tab)"); sleep 2; kill 9, $pid; sleep 5; system("ps auxf"); sub run_in_bg { $pid = fork(); if($pid==0) { exec("firefox -private about:blank"); exit(0); } return $pid }
Anyone see what I am doing wrong?

Replies are listed 'Best First'.
Re: firefox ghosting when forked
by Corion (Patriarch) on Aug 22, 2012 at 20:13 UTC
      I was looking into using Firefox::Application's quit command but I really wanted to know what I was doing wrong first.

        I'm unfamiliar with the term "ghosting" when related to processes and IPC. Maybe you can explain what you mean when you use this term?