ravenpl
asked on
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.
#!/usr/bin/perl
#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.ex e'} 'thunderbird' || die;
}
if (0 == fork()) #child
{
sleep(10);
chdir('C:\Program Files\Mozilla Firefox');
exec {'C:\Program Files\Mozilla Firefox\firefox.exe'} 'firefox' || die;
}
exit(0);
The console is opened and never closed automatically.
#!/usr/bin/perl
#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.ex
}
if (0 == fork()) #child
{
sleep(10);
chdir('C:\Program Files\Mozilla Firefox');
exec {'C:\Program Files\Mozilla Firefox\firefox.exe'} 'firefox' || die;
}
exit(0);
ASKER
> 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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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?