in reply to system() requires double ctrl-c

Yes, I've been annoyed by that as well.

But what if you wanted to kill just the child and keep the parent running?

Obviously, the best thing to do is to just ask whether you wanted to kill them both or instead wanted to leave the parent running. Which is why "superior" operating systems do just that:

Terminate batch job (Y/N)?

Except that gets annoying as well. :)

Other than the case of system in a loop, requiring two CTRL-Cs is a reasonable compromise way of letting you say "kill them both" while still allowing you to say "just kill the child".

Which leads to the most annoying thing about the "Terminate batch job (Y/N)?" question: It interprets CTRL-C as "No"! Grr.

In the case of system in a loop, it is probably a good idea to notice that your child was terminated with SIGINT and prompt the user or even just sleep for a fraction of a second so that one can get that second CTRL-C in fast enough.

- tye        

Replies are listed 'Best First'.
Re^2: system() requires double ctrl-c (cases)
by wol (Hermit) on Nov 10, 2008 at 13:21 UTC
    I just wind up hammering ctrl-c till the prompt comes back (sometimes whilst muttering obscenities just slightly too audibly for an open plan office).

    But what if you wanted to kill just the child and keep the parent running?

    From the perspective of the end user, this distinction doesn't make much sense. If I run a command, and then hit ctrl-c, then I want it to kill the command I ran. I just don't care how that command was implemented: whether it was implemented with a single process or a whole tree of them.

    (I might appreciate special handling of ctrl-c if the command I ran provides some sort of interactive environment (eg a command line text editor). That would probably need to be considered on a case-by-case basis.)

    Many annoying things. Even the weather is abysmal today. Grr.

    This post was brought to you by the adjectives "grumpy" and "wet".

    --
    .sig : File not found.