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 6965623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:05:08+00:00 2026-05-27T16:05:08+00:00

Normally, Control-C sends a sigint to a program, and kills it if it’s not

  • 0

Normally, Control-C sends a sigint to a program, and kills it if it’s not caught. The gnureadline library will install handlers for sigint. However, even when disabling those handlers in haskell, I still need to hit Control-C twice to kill a program. What’s going on?

import System.Console.Readline

main = do 
        setCatchSignals False
        mainLoop


mainLoop = do
        maybeLine <- readline ">"
        case maybeLine of
            Nothing -> putStrLn ":("
            Just line -> do 
                            putStr line 
                            putStr " catch:"
                            catch <- getCatchSignals
                            putStrLn $ show $ catch
        mainLoop
  • 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-27T16:05:08+00:00Added an answer on May 27, 2026 at 4:05 pm

    This may be related to the cooked/uncooked/rare terminal modes; ^C does not always send a signal. It seems likely that readline uncooks the terminal, and thus any signals caused by keyboard input must be due to logic within readline itself; it seems plausible that it might only trigger a SIGINT on two sequential ^Cs (especially since for many programs that utilise readline such as shells and REPLs, the program exiting on a single ^C would be very annoying!).

    You might be able to change this behaviour by using the readline API to rebind ^C to some of your own code that triggers a SIGINT. I haven’t used readline from Haskell, just from C, so I’m not sure exactly how you’d go about this, but the binding seems rich enough to achieve it.

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

Sidebar

Related Questions

Control Panel items are normally registered under HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\NameSpace , however a lot of the
Normally, to obtain the collection view of a control, I will call the following:
Normally when you want a databound control to 'update,' you use the PropertyChanged event
I am trying to get a control (not a controller -- a subclass of
I need to validate a control input on losing focus. Normally I'd use the
This is a general question which will apply to any WPF control. What I
What do you all normally do when checking code out of version control software
I have a chart control that works normally for all but one case. If
The WinForms ProgressBar control allows its foreground color to be set. While this normally
Normally, if I complete a form, the data will be sent to the server

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.