while(1) { system("echo 111"); exit if ($? & 127) == 2; # SIGINT == 2 on my system }