Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
process
Commits
d10b168a
Commit
d10b168a
authored
Nov 30, 2012
by
ian@well-typed.com
Browse files
Bump base lower version to 4.5 (the version GHC 7.4.1 came with)
and remove code to support older versions
parent
10836cc2
Changes
5
Hide whitespace changes
Inline
Side-by-side
System/Cmd.hs
View file @
d10b168a
{-# LANGUAGE CPP #-}
#
if
__GLASGOW_HASKELL__
>=
701
#
if
def
__GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#
endif
...
...
System/Process.hs
View file @
d10b168a
{-# LANGUAGE CPP, ForeignFunctionInterface #-}
#
if
__GLASGOW_HASKELL__
>=
701
#
if
def
__GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE InterruptibleFFI #-}
#
endif
...
...
@@ -90,11 +90,7 @@ import Data.Maybe
import
System.Exit
(
ExitCode
(
..
)
)
#
ifdef
__GLASGOW_HASKELL__
#
if
__GLASGOW_HASKELL__
>=
611
import
GHC.IO.Exception
(
ioException
,
IOErrorType
(
..
),
IOException
(
..
)
)
#
else
import
GHC.IOBase
(
ioException
,
IOErrorType
(
..
)
)
#
endif
#
if
defined
(
mingw32_HOST_OS
)
import
System.Win32.Process
(
getProcessId
)
import
System.Win32.Console
(
generateConsoleCtrlEvent
,
cTRL_BREAK_EVENT
)
...
...
@@ -482,7 +478,7 @@ readProcessWithExitCode cmd args input =
hFlush
inh
hClose
inh
#
if
defined
(
__GLASGOW_HASKELL__
)
&&
__GLASGOW_HASKELL__
>=
611
#
if
defined
(
__GLASGOW_HASKELL__
)
C
.
catch
writeInput
$
\
e
->
case
e
of
IOError
{
ioe_type
=
ResourceVanished
,
ioe_errno
=
Just
ioe
}
...
...
@@ -706,11 +702,6 @@ foreign import ccall unsafe "getProcessExitCode"
->
Ptr
CInt
->
IO
CInt
#
if
__GLASGOW_HASKELL__
<
701
-- not available prior to 7.1
#
define
interruptible
safe
#
endif
foreign
import
ccall
interruptible
"waitForProcess"
-- NB. safe - can block
c_waitForProcess
::
PHANDLE
...
...
System/Process/Internals.hs
View file @
d10b168a
...
...
@@ -2,7 +2,7 @@
{-# OPTIONS_HADDOCK hide #-}
{-# OPTIONS_GHC -w #-}
-- XXX We get some warnings on Windows
#
if
__GLASGOW_HASKELL__
>=
701
#
if
def
__GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#
endif
...
...
@@ -66,7 +66,6 @@ import Foreign
#
ifdef
__GLASGOW_HASKELL__
import
System.Posix.Internals
#
if
__GLASGOW_HASKELL__
>=
611
import
GHC.IO.Exception
import
GHC.IO.Encoding
import
qualified
GHC.IO.FD
as
FD
...
...
@@ -81,10 +80,6 @@ import Data.Typeable
import
GHC.IO.IOMode
import
System.Win32.DebugApi
(
PHANDLE
)
#
endif
#
else
import
GHC.IOBase
(
haFD
,
FD
,
IOException
(
..
)
)
import
GHC.Handle
#
endif
#
elif
__HUGS__
...
...
@@ -92,9 +87,7 @@ import Hugs.Exception ( IOException(..) )
#
endif
#
ifdef
base4
import
System.IO.Error
(
ioeSetFileName
)
#
endif
#
if
defined
(
mingw32_HOST_OS
)
import
Control.Monad
(
when
)
import
System.Directory
(
doesFileExist
)
...
...
@@ -388,10 +381,7 @@ fd_stderr = 2
mbFd
::
String
->
FD
->
StdStream
->
IO
FD
mbFd
_
_std
CreatePipe
=
return
(
-
1
)
mbFd
_fun
std
Inherit
=
return
std
mbFd
fun
_std
(
UseHandle
hdl
)
=
#
if
__GLASGOW_HASKELL__
<
611
withHandle_
fun
hdl
$
return
.
haFD
#
else
mbFd
fun
_std
(
UseHandle
hdl
)
=
withHandle
fun
hdl
$
\
h
@
Handle__
{
haDevice
=
dev
,
..
}
->
case
cast
dev
of
Just
fd
->
do
...
...
@@ -403,7 +393,6 @@ mbFd fun _std (UseHandle hdl) =
ioError
(
mkIOError
illegalOperationErrorType
"createProcess"
(
Just
hdl
)
Nothing
`
ioeSetErrorString
`
"handle is not a file descriptor"
)
#
endif
mbPipe
::
StdStream
->
Ptr
FD
->
IOMode
->
IO
(
Maybe
Handle
)
mbPipe
CreatePipe
pfd
mode
=
fmap
Just
(
pfdToHandle
pfd
mode
)
...
...
@@ -413,7 +402,6 @@ pfdToHandle :: Ptr FD -> IOMode -> IO Handle
pfdToHandle
pfd
mode
=
do
fd
<-
peek
pfd
let
filepath
=
"fd:"
++
show
fd
#
if
__GLASGOW_HASKELL__
>=
611
(
fD
,
fd_type
)
<-
FD
.
mkFD
(
fromIntegral
fd
)
mode
(
Just
(
Stream
,
0
,
0
))
-- avoid calling fstat()
False
{-is_socket-}
...
...
@@ -421,16 +409,6 @@ pfdToHandle pfd mode = do
fD
<-
FD
.
setNonBlockingMode
fD
True
-- see #3316
enc
<-
getLocaleEncoding
mkHandleFromFD
fD
fd_type
filepath
mode
False
{-is_socket-}
(
Just
enc
)
#
else
fdToHandle'
fd
(
Just
Stream
)
False
{-Windows: not a socket, Unix: don't set non-blocking-}
filepath
mode
True
{-binary-}
#
endif
#
if
__GLASGOW_HASKELL__
<
703
getLocaleEncoding
::
IO
TextEncoding
getLocaleEncoding
=
return
localeEncoding
#
endif
#
ifndef
__HUGS__
-- ----------------------------------------------------------------------------
...
...
@@ -478,13 +456,7 @@ commandToProcess (RawCommand cmd args) = do
findCommandInterpreter
::
IO
FilePath
findCommandInterpreter
=
do
-- try COMSPEC first
#
ifdef
base3
catchJust
(
\
e
->
case
e
of
IOException
e
|
isDoesNotExistError
e
->
Just
e
_otherwise
->
Nothing
)
#
else
catchJust
(
\
e
->
if
isDoesNotExistError
e
then
Just
e
else
Nothing
)
#
endif
(
getEnv
"COMSPEC"
)
$
\
e
->
do
-- try to find CMD.EXE or COMMAND.COM
...
...
@@ -607,11 +579,7 @@ translate str
withFilePathException
::
FilePath
->
IO
a
->
IO
a
withFilePathException
fpath
act
=
handle
mapEx
act
where
#
ifdef
base4
mapEx
ex
=
ioError
(
ioeSetFileName
ex
fpath
)
#
else
mapEx
(
IOException
(
IOError
h
iot
fun
str
_
))
=
ioError
(
IOError
h
iot
fun
str
(
Just
fpath
))
#
endif
#
if
!
defined
(
mingw32_HOST_OS
)
&&
!
defined
(
__MINGW32__
)
withCEnvironment
::
[(
String
,
String
)]
->
(
Ptr
CString
->
IO
a
)
->
IO
a
...
...
cbits/runProcess.c
View file @
d10b168a
...
...
@@ -89,9 +89,7 @@ runInteractiveProcess (char *const args[],
{
case
-
1
:
unblockUserSignals
();
#if __GLASGOW_HASKELL__ > 612
startTimer
();
#endif
if
(
fdStdIn
==
-
1
)
{
close
(
fdStdInput
[
0
]);
close
(
fdStdInput
[
1
]);
...
...
process.cabal
View file @
d10b168a
...
...
@@ -22,8 +22,6 @@ source-repository head
type: git
location: http://darcs.haskell.org/packages/process.git/
flag base4
Library {
exposed-modules: System.Cmd
if !impl(nhc98) {
...
...
@@ -48,15 +46,7 @@ Library {
build-depends: unix
}
if (flag(base4)) {
build-depends: base >= 4 && < 5
cpp-options: -Dbase4
-- later, we can use the new MIN_VERSION_base() stuff that
-- arrived in Cabal-1.6.
} else {
build-depends: base >= 3 && < 4
cpp-options: -Dbase3
}
build-depends: base >= 4.5 && < 5
build-depends: directory >= 1.0 && < 1.3,
filepath >= 1.1 && < 1.4,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment