Skip to content

Commit 0049f91

Browse files
committed
Drop various process <1.2.1.0 compatibility shims
1 parent 0c95265 commit 0049f91

File tree

4 files changed

+2
-52
lines changed

4 files changed

+2
-52
lines changed

Cabal/src/Distribution/Compat/Process.hs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@ module Distribution.Compat.Process (
1111
import System.Exit (ExitCode (..))
1212
import System.IO (Handle)
1313

14-
import System.Process (CreateProcess, ProcessHandle)
14+
import System.Process (CreateProcess, ProcessHandle, waitForProcess)
1515
import qualified System.Process as Process
1616

17-
#if MIN_VERSION_process(1,2,0)
18-
import System.Process (waitForProcess)
19-
#endif
20-
2117
#if defined(mingw32_HOST_OS) && MIN_VERSION_process(1,6,9)
2218
import System.IO.Unsafe (unsafePerformIO)
2319
import System.Win32.Info.Version (dwMajorVersion, dwMinorVersion, getVersionEx)
@@ -74,13 +70,8 @@ createProcess = Process.createProcess . enableProcessJobs
7470
-- See 'enableProcessJobs'.
7571
rawSystem :: String -> [String] -> IO ExitCode
7672
rawSystem cmd args = do
77-
#if MIN_VERSION_process(1,2,0)
7873
(_,_,_,p) <- createProcess (Process.proc cmd args) { Process.delegate_ctlc = True }
7974
waitForProcess p
80-
#else
81-
-- With very old 'process', just do its rawSystem
82-
Process.rawSystem cmd args
83-
#endif
8475

8576
-- | 'System.Process.runInteractiveProcess' with process jobs enabled when
8677
-- appropriate. See 'enableProcessJobs'.

Cabal/src/Distribution/Simple/Utils.hs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -779,13 +779,7 @@ rawSystemExitWithEnv verbosity path args env = withFrozenCallStack $ do
779779
hFlush stdout
780780
(_,_,_,ph) <- createProcess $
781781
(Process.proc path args) { Process.env = (Just env)
782-
#ifdef MIN_VERSION_process
783-
#if MIN_VERSION_process(1,2,0)
784-
-- delegate_ctlc has been added in process 1.2, and we still want to be able to
785-
-- bootstrap GHC on systems not having that version
786782
, Process.delegate_ctlc = True
787-
#endif
788-
#endif
789783
}
790784
exitcode <- waitForProcess ph
791785
unless (exitcode == ExitSuccess) $ do
@@ -858,13 +852,7 @@ createProcessWithEnv verbosity path args mcwd menv inp out err = withFrozenCallS
858852
, Process.std_in = inp
859853
, Process.std_out = out
860854
, Process.std_err = err
861-
#ifdef MIN_VERSION_process
862-
#if MIN_VERSION_process(1,2,0)
863-
-- delegate_ctlc has been added in process 1.2, and we still want to be able to
864-
-- bootstrap GHC on systems not having that version
865855
, Process.delegate_ctlc = True
866-
#endif
867-
#endif
868856
}
869857
return (inp', out', err', ph)
870858

cabal-testsuite/main/cabal-tests.hs

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,7 @@ import qualified System.Clock as Clock
2525
import System.IO
2626
import System.FilePath
2727
import System.Exit
28-
import System.Process (
29-
#if MIN_VERSION_process(1,2,0)
30-
callProcess,
31-
#else
32-
proc, createProcess, waitForProcess, terminateProcess,
33-
#endif
34-
showCommandForUser)
28+
import System.Process (callProcess, showCommandForUser)
3529

3630
#if !MIN_VERSION_base(4,12,0)
3731
import Data.Monoid ((<>))
@@ -288,20 +282,3 @@ getTime = do
288282
t <- Clock.getTime Clock.Monotonic
289283
let ns = realToFrac $ Clock.toNanoSecs t
290284
return $ ns / 10 ^ (9 :: Int)
291-
292-
-------------------------------------------------------------------------------
293-
-- compat
294-
-------------------------------------------------------------------------------
295-
296-
#if !MIN_VERSION_process(1,2,0)
297-
callProcess :: FilePath -> [String] -> IO ()
298-
callProcess cmd args = do
299-
exit_code <- bracket (createProcess (proc cmd args)) cleanupProcess
300-
$ \(_, _, _, ph) -> waitForProcess ph
301-
case exit_code of
302-
ExitSuccess -> return ()
303-
ExitFailure r -> fail $ "processFailedException " ++ show (cmd, args, r)
304-
where
305-
cleanupProcess (_, _, _, ph) = terminateProcess ph
306-
307-
#endif

cabal-testsuite/src/Test/Cabal/Server.hs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,9 @@ initServer s0 = do
259259
#else
260260
pid <- withProcessHandle (serverProcessHandle s0) $ \ph ->
261261
case ph of
262-
#if MIN_VERSION_process(1,2,0)
263262
OpenHandle x -> return (show x)
264263
-- TODO: handle OpenExtHandle?
265264
_ -> return (serverProcessId s0)
266-
#else
267-
OpenHandle x -> return (ph, show x)
268-
-- TODO: handle OpenExtHandle?
269-
_ -> return (ph, serverProcessId s0)
270-
#endif
271265
#endif
272266
let s = s0 { serverProcessId = pid }
273267
-- We will read/write a line at a time, including for

0 commit comments

Comments
 (0)