in reply to How to make `system` not ignore SIG INT in Perl?

It's not that the command spawned by system ignores SIGINT. It's the fact that once it terminates, your program immediately spawns another. You'd have to time your ^C so it's send when Perl does something else than waiting for the child process to finish. Or you inspect $?:
while(1) { system("echo 111"); exit if ($? & 127) == 2; # SIGINT == 2 on my system }

Replies are listed 'Best First'.
Re^2: How to make `system` not ignore SIG INT in Perl?
by PerlOnTheWay (Monk) on Sep 13, 2011 at 07:03 UTC

    Try this,seems it's not working for complex case:

    perl -we 'while(1){system("echo " . "1 "x 10000 . "|more");exit if ($? + & 127) == 2;}'

      The added pipe means that there now sits a shell between your program and the child processes. I would assume that the shell does not pass on the exit status of its children.

        It does!:
        $ perl -E 'system "sleep 3 | tail "; say $?' ^C2