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

stack exec should propagate +RTS-options better #1655

Closed
michaxm opened this issue Jan 14, 2016 · 9 comments
Closed

stack exec should propagate +RTS-options better #1655

michaxm opened this issue Jan 14, 2016 · 9 comments

Comments

@michaxm
Copy link

michaxm commented Jan 14, 2016

stack new example
cd example
stack build --profile --executable-profiling --library-profiling
stack exec  example +RTS  -p

... fails with: the flag -p requires the program to be built with -prof

.stack-work/install/.../example +RTS -p

works.

It would be nice to use exec for this use case as well, as it is time consuming to discover you can't. I would consider this a feature request, cabal-install seems to have the same issue: http://stackoverflow.com/questions/22942194/profiling-an-executable-with-cabal

Could not find a documented "won't work / won't fix" anywhere for stack, so a decision documentation here would be nice.

@mgsloan
Copy link
Contributor

mgsloan commented Jan 14, 2016

The issue is that +RTS -p is getting interpreted by the stack executable. Use a -- to separate out the inner invocation - stack exec -- example +RTS -p. See the docs on this

@mgsloan mgsloan closed this as completed Jan 14, 2016
@mgsloan mgsloan added this to the Support milestone Jan 14, 2016
@michaxm
Copy link
Author

michaxm commented Jan 15, 2016

A part of the instructions I have overlooked so far, thanks a lot.

@ndmitchell
Copy link
Contributor

This issue still persists. In particular the +RTS -p option after -- doesn't get passed through on Windows. As a concrete example:

stack new example
cd example
stack build
stack exec  -- example-exe +RTS  -?

This does not print out the help for example-exe, and examining process explorer the +RTS -? argument is not passed onwards.

@mgsloan
Copy link
Contributor

mgsloan commented Nov 11, 2016

@ndmitchell Curious, that works just fine for me on linux.

This reminded me of this comment - #2022 (comment) . Perhaps stack exec --RTS -- example-exe +RTS -? will work? Or perhaps stack exec example-exe --RTS -- +RTS -??

@ndmitchell
Copy link
Contributor

@mgsloan I confirm both those things work. Do you do anything special to get the other one working? Is this a GHC issue? Should there be a --rts=... flag to stack to make this easier and consistent?

@varosi
Copy link

varosi commented Jan 24, 2017

Will "--RTS" be automatically included in stack?
Currently it's not logical stack invocation to not work without --RTS:

myapp +RTS -s
stack exec -- myapp +RTS -s

It's logical both to be identical, but they aren't even on the latest stack-1.3.2 on Windows.

@mgsloan
Copy link
Contributor

mgsloan commented Jan 31, 2017

I think it'd be reasonable to add a --rts flag as @ndmitchell suggests. Does someone want to write a patch for this?

It'd also be worthwhile to explore whether we can get stack exec -- myapp +RTS -s to just work. It may be rather tricky because the runtime system parses the arguments first.

@AndreasPK
Copy link
Contributor

Can this be closed via #3012 ?

@ndmitchell
Copy link
Contributor

This answers my need, and covers what was discussed, so closing.

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

5 participants