Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Cabal
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository 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
Glasgow Haskell Compiler
Packages
Cabal
Commits
dcdbe26b
Commit
dcdbe26b
authored
5 years ago
by
Josh Meredith
Browse files
Options
Downloads
Patches
Plain Diff
Pass `@...` as a literal argument if the response file does not exist
parent
9c31d9c7
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
Cabal/Distribution/Compat/ResponseFile.hs
+9
-12
9 additions, 12 deletions
Cabal/Distribution/Compat/ResponseFile.hs
with
9 additions
and
12 deletions
Cabal/Distribution/Compat/ResponseFile.hs
+
9
−
12
View file @
dcdbe26b
{-# LANGUAGE CPP #-}
#
if
!
MIN_VERSION_base
(
4
,
12
,
0
)
{-# LANGUAGE ScopedTypeVariables #-}
#
endif
-- Compatibility layer for GHC.ResponseFile
-- Implementation from base 4.12.0 is used.
-- http://hackage.haskell.org/package/base-4.12.0.0/src/LICENSE
module
Distribution.Compat.ResponseFile
(
expandResponse
)
where
import
Control.Exception
import
System.IO
#
if
MIN_VERSION_base
(
4
,
12
,
0
)
import
GHC.ResponseFile
(
expandResponse
)
import
GHC.ResponseFile
(
unescapeArgs
)
#
else
import
Control.Exception
import
System.Exit
(
exitFailure
)
import
System.IO
import
Data.Char
(
isSpace
)
unescapeArgs
::
String
->
[
String
]
...
...
@@ -49,6 +46,8 @@ unescape args = reverse . map reverse $ go args NoneQ False [] []
|
'"'
==
c
=
go
cs
DblQ
False
a
as
|
otherwise
=
go
cs
NoneQ
False
(
c
:
a
)
as
#
endif
expandResponse
::
[
String
]
->
IO
[
String
]
expandResponse
=
fmap
concat
.
mapM
expand
where
...
...
@@ -57,8 +56,6 @@ expandResponse = fmap concat . mapM expand
expand
x
=
return
[
x
]
readFileExc
f
=
readFile
f
`
catch
`
\
(
e
::
IOException
)
->
do
hPutStrLn
stderr
$
"Error while expanding response file: "
++
show
e
exitFailure
#
endif
readFile
f
`
catch
`
\
(
_e
::
IOException
)
->
do
hPutStrLn
stderr
$
"Response file `@"
++
f
++
"` does not exist, assuming literal argument."
return
(
'@'
:
f
)
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