Why this will not finish?

I have this trivial(i thought) script run under windows with ActiveStatePerl. The problem with this script is that it will not finish.
The console is opened and never closed automatically.

#open(STDIN, "</dev/null"); # how should I do it under windows?
#open(STDOUT, ">/dev/null");
#open(STDERR, ">/dev/null");

if (0 == fork()) #child
      chdir('C:\Program Files\Mozilla Thunderbird');
      exec {'C:\Program Files\Mozilla Thunderbird\thunderbird.exe'} 'thunderbird' || die;

if (0 == fork()) #child
      chdir('C:\Program Files\Mozilla Firefox');
      exec {'C:\Program Files\Mozilla Firefox\firefox.exe'} 'firefox' || die;

LVL 43
Who is Participating?
group0Connect With a Mentor Commented:
The last comment on the following perlmonks page has a cross-platform example of background process spawning: http://www.perlmonks.org/?node_id=663081

To make the shell run your script and exit as soon as your it is complete, you can just:

Run->cmd.exe /C script.pl
So what is happening.

What I see is that it is making two sub-processes one opens thunderbird and the second one opens firefox.

You simply have nothing to end or destroy the objects.

What do you want to do?
ravenplAuthor Commented:
> What do you want to do?
I want to spawn two subprocesses and terminate the father. However the terminal window will not shut itself. Like it ignores the exit() statement.
Additionally, if TB abd FF are already running, the perl window shuts as expected.
All Courses

From novice to tech pro — start learning today.