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

Error when using RTS options with the Stack script interpreter #3658

Closed
danclien opened this Issue Dec 15, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@danclien

danclien commented Dec 15, 2017

General

Using Stack as a script interpreter doesn't accept RTS options as noted in the Stack documentation.

I'm not sure if there's a bug with Stack or an error in the documentation.

Steps to reproduce

  1. Put the following in a file:
    #!/usr/bin/env stack
    {- stack
      script
      --resolver lts-6.25
      --package turtle
      --
      +RTS -s -RTS
    -}
    
    main :: IO
    main = putStrLn "Hello, world!"
    
  2. Make the file executable
    $ chmod +x <file>
    
  3. Execute the file
    $ ./<file>
    

Expected

The script should print Hello, world!.

Actual

The script errors out with the following:

target ‘+RTS’ is not a module name or a source file

Output

$ stack --version
Version 1.6.1, Git revision f25811329bbc40b0c21053a8160c56f923e1201b (5435 commits) x86_64 hpack-0.20.0
$ cat ./StackScriptTest.hs
#!/usr/bin/env stack
{- stack
  script
  --resolver lts-6.25
  --package turtle
  --
  +RTS -s -RTS
-}

main :: IO
main = putStrLn "Hello, world!"
$ ./StackScriptTest.hs
target ‘/home/dacali/projects/onefile/+RTS’ is not a module name or a source file

Stack version

$ stack --version
Version 1.6.1, Git revision f25811329bbc40b0c21053a8160c56f923e1201b (5435 commits) x86_64 hpack-0.20.0

Method of installation

  • Upgraded with stack upgrade
@mgsloan

This comment has been minimized.

Collaborator

mgsloan commented Dec 18, 2017

Hi! Thanks for the report. I've opened a PR, #3668 which resolves this issue.

@mgsloan mgsloan added this to the P1: Must milestone Dec 18, 2017

@danclien

This comment has been minimized.

danclien commented Dec 18, 2017

@mgsloan, thanks for the quick response!

mgsloan added a commit that referenced this issue Dec 19, 2017

lwm added a commit that referenced this issue Dec 19, 2017

Merge pull request #3668 from commercialhaskell/script-interpreter-fi…
…le-arg-position-3658

Put file arguments first when stack is run as script interpreter #3658
@lwm

This comment has been minimized.

Member

lwm commented Dec 19, 2017

Done in #3668. Thanks for the report @danclien.

@lwm lwm closed this Dec 19, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment