Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
f6dae381
Commit
f6dae381
authored
Oct 14, 2013
by
Luite Stegeman
Browse files
make rawSystemIOWithEnv close its handles
parent
e5b06109
Changes
1
Hide whitespace changes
Inline
Side-by-side
Cabal/Distribution/Simple/Utils.hs
View file @
f6dae381
...
@@ -175,7 +175,7 @@ import System.Directory
...
@@ -175,7 +175,7 @@ import System.Directory
import
System.IO
import
System.IO
(
Handle
,
openFile
,
openBinaryFile
,
openBinaryTempFile
(
Handle
,
openFile
,
openBinaryFile
,
openBinaryTempFile
,
IOMode
(
ReadMode
),
hSetBinaryMode
,
IOMode
(
ReadMode
),
hSetBinaryMode
,
hGetContents
,
stderr
,
stdout
,
hPutStr
,
hFlush
,
hClose
)
,
hGetContents
,
stdin
,
stderr
,
stdout
,
hPutStr
,
hFlush
,
hClose
)
import
System.IO.Error
as
IO.Error
import
System.IO.Error
as
IO.Error
(
isDoesNotExistError
,
isAlreadyExistsError
(
isDoesNotExistError
,
isAlreadyExistsError
,
ioeSetFileName
,
ioeGetFileName
,
ioeGetErrorString
)
,
ioeSetFileName
,
ioeGetFileName
,
ioeGetErrorString
)
...
@@ -473,9 +473,15 @@ rawSystemIOWithEnv verbosity path args mcwd menv inp out err = do
...
@@ -473,9 +473,15 @@ rawSystemIOWithEnv verbosity path args mcwd menv inp out err = do
,
Process
.
std_err
=
mbToStd
err
}
,
Process
.
std_err
=
mbToStd
err
}
unless
(
exitcode
==
ExitSuccess
)
$
do
unless
(
exitcode
==
ExitSuccess
)
$
do
debug
verbosity
$
path
++
" returned "
++
show
exitcode
debug
verbosity
$
path
++
" returned "
++
show
exitcode
mapM_
maybeClose
[
inp
,
out
,
err
]
return
exitcode
return
exitcode
where
where
-- Also taken from System.Process
-- Also taken from System.Process
maybeClose
::
Maybe
Handle
->
IO
()
maybeClose
(
Just
hdl
)
|
hdl
/=
stdin
&&
hdl
/=
stdout
&&
hdl
/=
stderr
=
hClose
hdl
maybeClose
_
=
return
()
mbToStd
::
Maybe
Handle
->
StdStream
mbToStd
::
Maybe
Handle
->
StdStream
mbToStd
Nothing
=
Inherit
mbToStd
Nothing
=
Inherit
mbToStd
(
Just
hdl
)
=
UseHandle
hdl
mbToStd
(
Just
hdl
)
=
UseHandle
hdl
...
...
Write
Preview
Markdown
is supported
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