process009 is environment (SIGHUP masking) dependent.
## Summary
process009 tests what exit code(s) get reported when a subprocess get's killed.
For this purpose it launches a python script that will unceremonially kill itself via sending itself the HUPSIG signal (1).
However when invoking the testsuite from a background process with HUPSIG disabled (as it can be when invoked from a non-terminal background process) every sub process will inherit this signal unless this is prevented somehow. For the testsuite driver this doesn't seem to be the case.
This means the subprocess under test (python) will send itself SIGHUP signal, ignore it, and then return successfully some of the time.
## Steps to reproduce
Here is a simple reproducer for the basic effect:
```
module Main (main) where
import System.Exit
import System.Posix.Signals
import System.Process
runPython :: IO ExitCode
runPython = do
(_, _, _, p) <- createProcess
(shell "exec python3 2>/dev/null -c 'import os; os.kill(os.getpid(), 1)'")
waitForProcess p
main :: IO ()
main = do
before <- runPython
_ <- installHandler sigHUP Default Nothing
unblockSignals (addSignal sigHUP emptySignalSet)
after <- runPython
putStrLn ("as inherited : " ++ show before)
putStrLn ("after enabling SIGHUP : " ++ show after)
```
We can run it with/without nohup (check the .out file when using nohup) and we will see:
```
andi@9f8107483745:~/ghc-process-bisect/.ai/repro$ rm nohup.out
andi@9f8107483745:~/ghc-process-bisect/.ai/repro$ ./NohupSigHup
as inherited : ExitFailure (-1)
after enabling SIGHUP : ExitFailure (-1)
andi@9f8107483745:~/ghc-process-bisect/.ai/repro$ nohup ./NohupSigHup
nohup: ignoring input and appending output to 'nohup.out'
andi@9f8107483745:~/ghc-process-bisect/.ai/repro$ cat nohup.out
as inherited : ExitSuccess
after enabling SIGHUP : ExitFailure (-1)
``
Given that the test simple tests as I understand that we get `-Signal` as result code I think the simplest fix will be to use SIGKILL (9) rather than HUP.
I will put up a patch.
## Environment
Optional:
* Operating System: Linux
/label ~"T::bug"
/label ~"needs triage"
issue