Skip to content
  • Zubin's avatar
    3bbde957
    Fix #21889, GHCi misbehaves with Ctrl-C on Windows · 3bbde957
    Zubin authored and Marge Bot's avatar Marge Bot committed
    On Windows, we create multiple levels of wrappers for GHCi which ultimately
    execute ghc --interactive. In order to handle console events properly, each of
    these wrappers must call FreeConsole() in order to hand off event processing to
    the child process. See #14150.
    
    In addition to this, FreeConsole must only be called from interactive processes (#13411).
    
    This commit makes two changes to fix this situation:
    
    1. The hadrian wrappers generated using `hadrian/bindist/cwrappers/version-wrapper.c` call `FreeConsole`
       if the CPP flag INTERACTIVE_PROCESS is set, which is set when we are generating a wrapper for GHCi.
    2. The GHCi wrapper in `driver/ghci/` calls the `ghc-$VER.exe` executable which is not wrapped rather
       than calling `ghc.exe` is is wrapped on windows (and usually non-interactive, so can't call `FreeConsole`:
    
       Before:
       ghci-$VER.exe calls ghci.exe which calls ghc.exe which calls ghc-$VER.exe
    
       After:
       ghci-$VER.exe calls ghci.exe which calls ghc-$VER.exe
    3bbde957
    Fix #21889, GHCi misbehaves with Ctrl-C on Windows
    Zubin authored and Marge Bot's avatar Marge Bot committed
    On Windows, we create multiple levels of wrappers for GHCi which ultimately
    execute ghc --interactive. In order to handle console events properly, each of
    these wrappers must call FreeConsole() in order to hand off event processing to
    the child process. See #14150.
    
    In addition to this, FreeConsole must only be called from interactive processes (#13411).
    
    This commit makes two changes to fix this situation:
    
    1. The hadrian wrappers generated using `hadrian/bindist/cwrappers/version-wrapper.c` call `FreeConsole`
       if the CPP flag INTERACTIVE_PROCESS is set, which is set when we are generating a wrapper for GHCi.
    2. The GHCi wrapper in `driver/ghci/` calls the `ghc-$VER.exe` executable which is not wrapped rather
       than calling `ghc.exe` is is wrapped on windows (and usually non-interactive, so can't call `FreeConsole`:
    
       Before:
       ghci-$VER.exe calls ghci.exe which calls ghc.exe which calls ghc-$VER.exe
    
       After:
       ghci-$VER.exe calls ghci.exe which calls ghc-$VER.exe
Loading