abecher has asked for the wisdom of the Perl Monks concerning the following question:
On unix, things act as expected: testexec.pl waits for testexec2.pl to finish (with testexec2.pl being replaced with testexec3.pl). But on windows, testexec.pl does NOT wait for testexec2.pl/testexec3.pl to finish. Is there a way to get Windows to act the same as unix? The windows behaviour does not seem correct...-> more testexec* :::::::::::::: testexec.pl :::::::::::::: #!/usr/bin/perl system("testexec2.pl"); print "Done $0\n"; :::::::::::::: testexec2.pl :::::::::::::: #!/usr/bin/perl exec($^X,"testexec3.pl") or print "exec failed - $!\n"; print "Done $0\n"; :::::::::::::: testexec3.pl :::::::::::::: #!/usr/bin/perl `sleep 3`; print "Done $0\n";
FYI: I'm trying to avoid using system() instead of exec() because then I open a can of worms regarding the quoting of arguements to the programs being exec()'d (the arguements themselves may contain quotes and/or spaces, and going through the shell on the two different OS's is a whole lot of extra code I can avoid if exec() would just act right :-)
Aaron
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: windows vs unix: different behaviour with exec()
by almut (Canon) on Nov 19, 2008 at 20:12 UTC | |
|
Re: windows vs unix: different behaviour with exec()
by zentara (Cardinal) on Nov 19, 2008 at 20:10 UTC | |
by rovf (Priest) on Nov 20, 2008 at 15:16 UTC | |
by almut (Canon) on Nov 20, 2008 at 15:49 UTC | |
by zentara (Cardinal) on Nov 20, 2008 at 15:51 UTC | |
|
Re: windows vs unix: different behaviour with exec()
by wol (Hermit) on Nov 20, 2008 at 15:03 UTC |