Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable -rtsopts for stack + document RTS opts via exec #2640

Closed
mgsloan opened this issue Sep 26, 2016 · 4 comments
Closed

Re-enable -rtsopts for stack + document RTS opts via exec #2640

mgsloan opened this issue Sep 26, 2016 · 4 comments

Comments

@mgsloan
Copy link
Contributor

mgsloan commented Sep 26, 2016

I am forking this off from #2022 because that thread got rather involved. I think the summary is:

  1. stack exec -- exeName +RTS ... works fine to pass RTS options because -- causes further RTS arguments to not be processed.

  2. stack exec exeName -- +RTS .. doesn't work because the -- is also visible to the exeName process.

One option for resolving this would be to deprecate the stack exec exeName -- ARGS form, perhaps even the stack exec exeName form. How can we deprecate it though? That would require adding stuff to stdout or stderr.

Either way, we should re-enable -rtsopts for stack, may as well have them if they are being parsed out of the commandline. Either way, we should thoroughly document using RTS options with exec.

@AndreasPK
Copy link
Contributor

AndreasPK commented Feb 16, 2017

This is not correct. Under windows 10 with Stack 1.3.2 and GHC 8.0.2 I get

> stack exec -- echo test +RTS -s1 -RTS -s2
test -s2

> stack exec echo -- test +RTS -s1 -RTS -s2
test -s2

> stack exec -- echo -- test +RTS -s1 -RTS -s2
-- test -s2

In ALL cases stack consumes the RTS options. Only --RTS would cause further rts arguments to be not processed according to #2022 (comment)

Passing --RTS works but is not an options since we would have to pass that to stack BEFORE the runtime can parse it:

> stack exec -- echo --RTS test +RTS -s1 -? -RTS -s2
test +RTS -s1 -? -RTS -s2

I wrote up code that adds an rts-options flag to explicitly pass RTS options along and will submit that as pull request when it's fleshed out. The result will be:

> stack exec --rts-options="-s" -- echo test
test +RTS -s -RTS

Edit: Under linux stack exec -- executable +RTS -s works it seems to be Windows specific for that to fail. Might be worth creating an Issue with GHC for this.

@rwbarton
Copy link

rwbarton commented Feb 17, 2017

The original issue description is correct, except to the extent that there's a bug on Windows only (which @AndreasPK identified and reported) that causes RTS options (or more properly, options that look like RTS options) that come after a -- not to be included in the program's argument list as returned by getArgs. The bug is https://ghc.haskell.org/trac/ghc/ticket/13287.

@AndreasPK
Copy link
Contributor

Can this be closed via (#3012)?

@mgsloan
Copy link
Contributor Author

mgsloan commented Oct 23, 2017

@AndreasPK Yep, thanks for noticing that!

@mgsloan mgsloan closed this as completed Oct 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants