diff --git a/tests/all.T b/tests/all.T index be7f16d2..4397eb6a 100644 --- a/tests/all.T +++ b/tests/all.T @@ -1,6 +1,6 @@ # some platforms use spawnp instead of exec in some cases, resulting # in spurious error output changes. -normalise_exec = normalise_fun(lambda s: s.replace('spawnp', 'exec')) +normalise_exec = normalise_fun(lambda s: s.replace('posix_spawnp', 'exec')) test('process001', extra_clean(['process001.out']), compile_and_run, ['']) test('process002', [fragile_for(16547, concurrent_ways), extra_clean(['process002.out'])], compile_and_run, ['']) diff --git a/tests/process009.hs b/tests/process009.hs index 7cd4c394..7cffd335 100644 --- a/tests/process009.hs +++ b/tests/process009.hs @@ -2,16 +2,22 @@ import Control.Monad import System.Exit import System.Process import Data.Maybe +import Data.List (intercalate) -- Test that we get the right exit code for processes that terminate -- with a signal (#7229) main = do - (_,_,_,p) <- createProcess (shell "kill -HUP $$") + let script = intercalate " " + [ "exec python3 2>/dev/null" + , "-c" + , "'import os; os.kill(os.getpid(), 1)'" + ] + (_,_,_,p) <- createProcess (shell script) waitForProcess p >>= print getProcessExitCode p >>= print - (_,_,_,p) <- createProcess (shell "kill -HUP $$") + (_,_,_,p) <- createProcess (shell script) forever $ do r <- getProcessExitCode p if (isJust r) then do print r; exitWith ExitSuccess else return () diff --git a/tests/process011.hs b/tests/process011.hs index eb68612f..8e1b43ee 100644 --- a/tests/process011.hs +++ b/tests/process011.hs @@ -14,9 +14,11 @@ main = do -- shell kills itself with SIGINT, -- delegation off, exit code (death by signal) reported as normal - do let script = intercalate "; " - [ "kill -INT $$" - , "exit 42" ] + do let script = intercalate " " + [ "exec python3 2>/dev/null" + , "-c" + , "'import os; os.kill(os.getpid(), 2)'" + ] (_,_,_,p) <- createProcess (shell script) { delegate_ctlc = False } waitForProcess p >>= print @@ -24,9 +26,11 @@ main = do -- shell kills itself with SIGINT, -- delegation on, so expect to throw UserInterrupt - do let script = intercalate "; " - [ "kill -INT $$" - , "exit 42" ] + do let script = intercalate " " + [ "exec python3 2>/dev/null" + , "-c" + , "'import os; os.kill(os.getpid(), 2)'" + ] (_,_,_,p) <- createProcess (shell script) { delegate_ctlc = True } (waitForProcess p >>= print) `catchUserInterrupt` \e -> putStrLn $ "caught: " ++ show e