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

Seems to me that ^C works quite fine when system is in progress:

$ perl -MTime::HiRes=time -E' for (;;) { my $s=time; system("sleep", "1"); say time-$s; } ' 1.0089168548584 1.00794720649719 1.00801014900208 ^C0.0198760032653809 ^C0.180072069168091 ^C0.147971153259277 ...

SIGINT is indeed being sent and received, and a process does indeed die as a result.

Perhaps you want to check the result returned by system and avoid looping if the child returned an error or died from a signal?

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 05:54 UTC

    I provided a minified example in my post,

    does ^C work in that case?

      I don't know how I could tell whether it worked or not using that example, but I have no reason to believe echo isn't receiving the signal or ignores it.

        When you press ^C, if it terminates, it works;otherwise it doesn't work.

        It doesn't terminates for me.