Syntactic Confectionery Delight | |
PerlMonks |
Re: Interaction of Windows Batch files and Perl's system() functionby Anonymous Monk |
on Sep 07, 2011 at 12:00 UTC ( [id://924589]=note: print w/replies, xml ) | Need Help?? |
Windows7 won't change anything :) What you have here, is cmd being cmd, the cmd way , and perl being perl cmd.exe is a special kind of program Instead of striking out the incorrect parts of my investigation below, everything is in readmore Read $ help call Install procexp.exe from http://live.sysinternals.com/ and start it from your experiment shell, and then watch the tree of processes after each action (like Ctrl+C) After launching the batch file, i see the cmd that launched the batch, its child, a perl process, with a child of cmd.exe On 1st ctrl+C, the perl process ends,
The perl process has ended, the cmd it launched is still around, but it is nobodys child When you launch a cmd from a cmd from a cmd, each subsequent cmd is a child of the former, and Ctrl+C doesn't kill it, or make it an orphan You'll notice, when you hit ctrl+c, you get double newlines, thats because, apparently, ctrl+c is being propagated to both cmds You'll also notice at first it won't take your y/n, but if you try it a second time, it will See, the thing is, all 3 things share the same STDIN/STDERR/STDOUT among other things I don't have a complete grasp of everything, but yes, there is a bug in there somewhere, probably in the perl dll hook, not detaching cleanly, maybe You might also be able to glean some leads from these frontends/wrappers for cmd.exe, eConsole and console2 On the other hand, perl on win32 has behaved this way for a long time (11+ years at least) So I can't help but think, the porters, and ActiveState, left it this way for a reason -- either its unfixable, or its the best compromise available ...
But that still leaves the problem of being prompted by the original shell running the batch file
I'm not sure how to signal to it, that everything is ok , no need to prompt, the answer probably lies in that dllhook business :/
In Section
Seekers of Perl Wisdom
|
|