Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 912729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:26:03+00:00 2026-05-15T17:26:03+00:00

Whats going on here? I thought SIGINT would be sent to the foreground process

  • 0

Whats going on here? I thought SIGINT would be sent to the foreground process group.

(I think, maybe, that system() is running a shell which is creating a new process group for the child process? Can anyone confirm this?)

% perl
local $SIG{INT} = sub { print "caught signal\n"; };
system('sleep', '10');

Then hit ctrl+d then ctrl+c immediately and notice that “caught signal” is never printed.

I feel like this is a simple thing… anyway to work around this? The problem is that when running a bunch of commands via system results in holding ctrl+c until all iterations are completed (because perl never gets the SIGINT) and is rather annoying…

How can this be worked around? (I already tested using fork() directly and understand that this works… this is not an acceptable solution at this time)

UPDATE: please note, this has nothing to do with “sleeping”, only the fact that the command takes some arbitrary long amount of time to run which is considerably more than that of the perl around it. So much so that pressing ctrl+c gets sent to the command (as its in the foreground process group?) and somehow manages to never be sent to perl.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T17:26:04+00:00Added an answer on May 15, 2026 at 5:26 pm

    from perldoc system:

    Since SIGINT and SIGQUIT are ignored during the execution of system,
    if you expect your program to terminate on receipt of these signals you will need to arrange to do so yourself based on the return value.

    @args = ("command", "arg1", "arg2");
    system(@args) == 0
       or die "system @args failed: $?"
    

    If you’d like to manually inspect system’s failure, you can check all possible failure
    modes by inspecting $? like this:

    if ($? == -1) {
        print "failed to execute: $!\n";
    }
    elsif ($? & 127) {
        printf "child died with signal %d, %s coredump\n",
           ($? & 127),  ($? & 128) ? 'with' : 'without';
    }
    else {
        printf "child exited with value %d\n", $? >> 8;
    }
    

    Alternatively, you may inspect the value of ${^CHILD_ERROR_NATIVE} with the W*() calls from the POSIX module

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not sure whats going on here, or what could be the integer in this
What I have going on here is a page that shows a list of
What's going on here? I'm trying to create a list of functions: def f(a,b):
What's going on here? BTW, MySQL Server version: 5.0.45-log Source distribution. mysql> select count(*)
Not sure what's going on here, but my iPhone apps nav bar shows back
Not sure what's going on here... My controller methods looks like this: [HttpGet] public
Not too sure what's going on here as this doesn't seem like standard practise
I'm not sure what's going on here but here's a section I'm having problems
Can someone visually explain what's going on here please. var stack = []; function
I'm not too sure what's going on here but I'm trying to echo a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.