Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
array
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vladislav Zavialov
array
Commits
880cb6cd
Commit
880cb6cd
authored
17 years ago
by
Ian Lynagh
Browse files
Options
Downloads
Patches
Plain Diff
open(Binary)TempFile is now portable
parent
9e674b44
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
System/IO.hs
+12
-4
12 additions, 4 deletions
System/IO.hs
with
12 additions
and
4 deletions
System/IO.hs
+
12
−
4
View file @
880cb6cd
...
...
@@ -157,10 +157,8 @@ module System.IO (
-- * Temporary files (not portable: GHC only)
#
ifdef
__GLASGOW_HASKELL__
openTempFile
,
openBinaryTempFile
,
#
endif
)
where
import
Data.Bits
...
...
@@ -170,6 +168,13 @@ import Foreign.C.Error
import
Foreign.C.String
import
System.Posix.Internals
#
ifdef
__GLASGOW_HASKELL__
import
GHC.Exception
as
ExceptionBase
hiding
(
catch
)
#
endif
#
ifdef
__HUGS__
import
Hugs.Exception
as
ExceptionBase
#
endif
#
ifdef
__GLASGOW_HASKELL__
import
GHC.Base
import
GHC.IOBase
-- Together these four Prelude modules define
...
...
@@ -450,8 +455,11 @@ openTempFile' loc tmp_dir template binary = do
then
findTempName
(
x
+
1
)
else
ioError
(
errnoToIOError
loc
errno
Nothing
(
Just
tmp_dir
))
else
do
h
<-
fdToHandle'
fd
Nothing
False
filepath
ReadWriteMode
True
`
catchException
`
\
e
->
do
c_close
fd
;
throw
e
-- XXX We want to tell fdToHandle what the filepath is,
-- as any exceptions etc will only be able to report the
-- fd currently
h
<-
fdToHandle
fd
`
ExceptionBase
.
catchException
`
\
e
->
do
c_close
fd
;
throw
e
return
(
filepath
,
h
)
where
filename
=
prefix
++
show
x
++
suffix
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment