We're drifting substantially from the subject and from modules at all but 
in the interest of getting to the bottom ...

At 01:54 PM 1/31/01 -0500, John Porter wrote:
>Well, maybe system() does that, but exec() does not return at all.

No, I said exec and meant it. My memory was a little fuzzy on the details 
but not on the basic point - exec on Windows does not behave like any other 
exec. I speak of NT 4.0, having no experience with other Windows platforms. 
But at least on NT, what I say is true of 5.6 as built by ActiveState and 
myself and of all prior win32 versions I've used going back to 5.004. The 
attached test case shows the behavior: exec starts the new process detached 
from the terminal and exits immediately. So it's true that it doesn't 
return but it still is completely unlike "real" exec. Assuming you have 
access to NT 4.0 and Perl 5.6, run the test case and hit carriage return as 
soon as the exec takes place - you'll see you're at the prompt without the 
wait you should have.

Now, there are many UNIX-compatibility-library builds of Perl such as 
Cygwin and MKS and it wouldn't be surprising if they called through to a 
compatibility version of exec that's more UNIX-like. In fact it would be 
surprising if they didn't, but the out-of-the-box compile of Perl for Win32 
behaves as described.

> > In any case, the plain fact is that  'system @cmd'
> > and 'system "@cmd"' are indistinguishable on Windows despite what the doc
> > so plainly says.
>
>Why do you care?

I'm surprised at this question - I care for the same exact reason Larry 
Wall cared enough to add the feature in the first place, because it's 
useful. Or to put it differently, because I can't robustly re-exec a 
command line passed in to me on Windows whereas I can on platforms that 
support no-shell system or exec. Are you questioning the utility of the 
feature or making a point I've missed?

David Boyce
$| = 1;
system qq($^X -e "print qq(in system(), waiting 5 seconds ...\n); sleep 5");
print "returned from system()\n";
exec qq($^X -e "print qq(in exec(), waiting 10 seconds (but you're at the prompt 
already!) ...\n); sleep 10");
print "returned from exec()\n";



Reply via email to