stack run command¶
stack run [-- ARGUMENT(S) (e.g. stack run -- file.txt)] [--[no-]ghc-package-path] [--[no-]stack-exe] [--package PACKAGE] [--rts-options RTSFLAG] [--cwd DIR]
stack run builds a project executable and runs it. If the command has a first
argument and it is recognised as an executable target then that is built.
Otherwise, the project's first executable is built. If the project has no
executables Stack reports no executables found as an error.
-- on the command line is interpreted as a command line
argument to be passed to what is run, other than a first argument recognised as
an executable target.
GHC_PACKAGE_PATHenvironment variable is set for the subprocess. Pass the
--no-ghc-package-pathflag to not set the variable; and
STACK_EXEenvironment variable is set with the path to Stack. Pass the
--no-stack-exeflag to not set the variable.
--cwd option can be used to set the working directory before the
executable is run.
--package option (which can be specified multiple times) can be used to
add a package name to build targets.
--rts-options option (which can be specified multiple times) can be used
to pass a list of GHC's
runtime system (RTS) options
to the executable when it is run. (The
-RTS must not be included.)