Skip to content
  • Michael Snoyman's avatar
    runghc: use executeFile to run ghc process on POSIX · c9042583
    Michael Snoyman authored and Ben Gamari's avatar Ben Gamari committed
    This means that, on POSIX systems, there will be only one ghc process
    used for running scripts, as opposed to the current situation of a
    runghc process and a ghc process. Beyond minor performance benefits of
    not having an extra fork and resident process, the more important impact
    of this is automatically getting proper signal handling. I noticed this
    problem myself when running runghc as PID1 inside a Docker container.
    
    I attempted to create a shim library for executeFile that would work for
    both POSIX and Windows, but unfortunately I ran into issues with exit
    codes being propagated correctly (see
    https://github.com/fpco/replace-process/issues/2). Therefore, this patch
    leaves the Windows behavior unchanged. Given that signals are a POSIX
    issue, this isn't too bad a trade-off. If someone has suggestions for
    better Windows _exec support, please let me know.
    
    Reviewers: erikd, austin, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: Phyx, thomie
    
    Differential Revision: https://phabricator.haskell.org/D2538
    
    (cherry picked from commit 42f1d867)
    c9042583