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

Self-executing scripts don't pipe plan construction errors from runhaskell to terminal #3942

Closed
docmoxie opened this Issue Mar 23, 2018 · 1 comment

Comments

Projects
None yet
4 participants
@docmoxie

docmoxie commented Mar 23, 2018

General summary/comments

Self-executing scripts don't pipe plan construction errors from runhaskell to terminal.

Steps to reproduce

Given a stack.yaml that uses a package that relies on another package from extra-deps:

resolver: lts-8.22

packages:
- location:
    git: git@github.com:cjdev/cloudseeder.git
    commit: c7068f25c41bcc0b4bdfc9b38ee5b05b5caefae5
  extra-dep: true

extra-deps:
- optparse-applicative-0.14.0.0

flags: {}

extra-package-dbs: []

...and a self-executing script that references that package, called script.hs:

#!/usr/bin/env stack
-- stack runhaskell --package cloud-seeder

main :: IO ()
main = putStrLn "yo"

Expected

With the - optparse-applicative-0.14.0.0 line in place, running gives the expected result:

$ ./script
yo
$ stack runhaskell --package cloud-seeder ./script.hs
yo

Actual

However, if we remove - optparse-applicative-0.14.0.0, only the direct call to runhaskell returns useful error information:

$ ./script
Plan construction failed.
$ stack runhaskell --package cloud-seeder ./script.hs

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for cloud-seeder-0.1.0.0:
    optparse-applicative-0.13.2.0 from stack configuration does not match >=0.14.0.0 (latest matching version is 0.14.2.0)
needed since cloud-seeder is a build target.

Some potential ways to resolve this:

  * Recommended action: try adding the following to your extra-deps in /Users/marnold/Code/lambda/runhaskell-test/stack.yaml:

- optparse-applicative-0.14.2.0

  * Set 'allow-newer: true' to ignore all version constraints and build anyway.

  * You may also want to try using the 'stack solver' command.

Plan construction failed.

Stack version

$ stack --version
Version 1.6.5, Git revision 24ab0d6ff07f28276e082c3ce74dfdeb1a2ca9e9 (5514 commits) x86_64 hpack-0.20.0

Method of installation

  • Official binary, downloaded from stackage.org or fpcomplete's package repository
@SkyWriter

This comment has been minimized.

Member

SkyWriter commented Jun 24, 2018

#4114 addresses this

isovector added a commit that referenced this issue Jun 24, 2018

Merge pull request #4114 from SkyWriter/feature/self-exec
Fixes self-executing scripts not piping plan construction errors from runhaskell to terminal, issue #3942

@dbaynard dbaynard closed this Jun 24, 2018

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