Fix compatibilities with unix 2.8.0.0

The version of unix removes the 3rd Maybe FileMode argument of openFd,
so we need to handle this breaking change using a MIN_VERSION macro. The
argument is integrated with the OpenFileFlags argument and the
integrated value in defaultFileFlags is Nothing, so there's no
difference between the two function calls.
This commit is contained in:
a5ob7r 2022-11-05 00:11:06 +09:00 committed by Tony Zorman
parent 9d0fd62cb2
commit faf5cf7b27

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleInstances #-}
@ -452,7 +453,11 @@ xfork x = io . forkProcess . finally nullStdin $ do
x
where
nullStdin = do
#if MIN_VERSION_unix(2,8,0)
fd <- openFd "/dev/null" ReadOnly defaultFileFlags
#else
fd <- openFd "/dev/null" ReadOnly Nothing defaultFileFlags
#endif
dupTo fd stdInput
closeFd fd