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

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

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

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

danclien opened this issue Dec 15, 2017 · 3 comments

Comments

@danclien
Copy link

@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
Copy link
Contributor

@mgsloan mgsloan commented Dec 18, 2017

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

@danclien
Copy link
Author

@danclien danclien commented Dec 18, 2017

@mgsloan, thanks for the quick response!

mgsloan added a commit that referenced this issue Dec 19, 2017
decentral1se pushed a commit that referenced this issue Dec 19, 2017
…le-arg-position-3658

Put file arguments first when stack is run as script interpreter #3658
@decentral1se
Copy link
Member

@decentral1se decentral1se commented Dec 19, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants