in reply to Re^5: How to make `system` not ignore SIG INT in Perl?
in thread How to make `system` not ignore SIG INT in Perl?

I want it to terminate the Perl program whenever I press ^C ...
  • Comment on Re^6: How to make `system` not ignore SIG INT in Perl?

Replies are listed 'Best First'.
Re^7: How to make `system` not ignore SIG INT in Perl?
by ikegami (Patriarch) on Sep 13, 2011 at 06:13 UTC

    Then you'll need to send a signal to the Perl program.

    ...ok, so Ctrl-C does send to both the child and parent, and the parent (Perl) does ignore it. Sorry.

    Back to the question, no, system's behaviour simply is not configurable.

      Is there a way to work around so that my provided script can terminate when pressing ^C?

      Or do something similar in another way?

        There are many tool to launch processes. IPC::Open3 should do it.
        open(local *CHILD_STDIN, '<', '/dev/null') or die $!; my $pid = open3( '<CHILD_STDIN', # Closed by open3 '>STDOUT', '>STDERR', ... ); waitpid($pid, 0);