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, as does the cmd.exe process, they're both gone from procexp/taskmanager
But cmd being so special, you have to exit really end the subshell , its the only way
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 thingsTerminating on signal SIGINT(2) $ Terminate batch job (Y/N)? y 'y' is not recognized as an internal or external command, operable program or batch file. $ y $ exit
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 ...
call perl -le " $SIG{INT}=q[IGNORE]; $ENV{X}='Y'; $ret = system('cmd') +; print qq[system returned $ret ]; "
But that still leaves the problem of being prompted by the original shell running the batch file
$ exit system returned 0 Terminate batch job (Y/N)? y
$ exit system returned 0 Terminate batch job (Y/N)? n finished
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 reply to Re: Interaction of Windows Batch files and Perl's system() function
by Anonymous Monk
in thread Interaction of Windows Batch files and Perl's system() function
by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |