Ticket #865 (closed defect: worksforme)

Opened 2 years ago

Last modified 18 months ago

Can't use command line options containing spaces

Reported by: bos Owned by:
Priority: normal Milestone:
Component: Cabal library Version: 1.10.1.0
Severity: normal Keywords:
Cc: Difficulty: unknown
GHC Version: Platform:

Description

I found myself wanting the other day to pass some specific RTS options to GHC on the command line, with those options varying depending on the version of GHC:

ghc-options: --with-rtsopts="-N -qg"

However, Cabal doesn't tokenize command line options, and GHC doesn't treat multiple --with-rtsopts arguments as building up a single string, so I found myself stuck. (I know about the "specify the options in a .c file, and that's what I did, but it's less elegant.)

Change History

Changed 2 years ago by duncan

  • status changed from new to closed
  • resolution set to worksforme

You can use options containing spaces in a .cabal file. You just have to quote the entire option:

ghc-options: "--with-rtsopts=-N -qg"

The whole thing will be passed as a single option. The " will not be passed.

This escaping (using Haskell String syntax) is documented in the user guide.

Changed 18 months ago by elga

Note: See TracTickets for help on using tickets.