Skip to content

Commit d2c3eb9

Browse files
committed
Document Stack's use of RTS options
1 parent 4b19880 commit d2c3eb9

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

doc/commands/build_command.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,11 @@ command line arguments. For example, to pass `'a single quoted string'`:
623623
The content of single quotes is taken literally. Within single quotes, `''`
624624
escapes a single quote.
625625

626+
!!! note "Runtime system (RTS) options"
627+
628+
RTS options must be quoted to prevent the RTS extracting them as its own
629+
when the Stack executable is run.
630+
626631
### `--exec` option
627632

628633
`stack build --exec '<command> [<argument(s)>]'` will run the specified command
@@ -700,6 +705,11 @@ command line arguments. For example, to pass `'a single quoted string'`:
700705
The content of single quotes is taken literally. Within single quotes, `''`
701706
escapes a single quote.
702707

708+
!!! note "Runtime system (RTS) options"
709+
710+
RTS options must be quoted to prevent the RTS extracting them as its own
711+
when the Stack executable is run.
712+
703713
## Flags affecting GHC's behaviour
704714

705715
### `--[no-]executable-profiling` flag

doc/commands/index.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,36 @@ of the guide and the part on [configuration](../configure/index.md) provide
1010
information about some of those features, organised as a reference guide. Some
1111
of the features are complex and separate pages are dedicated to them.
1212

13+
## stack command
14+
15+
Stack is usually used with one of its commands (see further below). However:
16+
17+
* `stack`, `stack --help` (or `-h`) lists Stack's commands, and flags and
18+
options common to those commands;
19+
20+
* `stack <command> --help` (or `-h`) — provides help on the particular Stack
21+
command, including flags and options specific to the command; and
22+
23+
* `stack --version` identifies the version and Git hash of the Stack executable.
24+
25+
!!! info "Runtime system (RTS) options"
26+
27+
The Stack executable is built by GHC with the `-rtsopts=some` option. This
28+
means that the RTS extracts command-line arguments bracketed between `+RTS`
29+
and `-RTS` as its own when Stack is run. Only the following RTS
30+
options are available:
31+
32+
* `-?` (e.g. `stack +RTS -?`) causes the RTS to output information about
33+
RTS options; and
34+
35+
* `--info` (e.g. `stack +RTS --info`) causes the RTS to output information
36+
about the RTS.
37+
38+
To avoid the RTS extracting such command-line arguments as its own when
39+
using Stack commands such as [`exec`](exec_command.md),
40+
[`test`](test_command.md) or [`bench`](bench_command.md), see the
41+
documentation for those commands.
42+
1343
## Stack commands (thematic)
1444

1545
### Setting up

0 commit comments

Comments
 (0)