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 script needs network to work normally? #5103

Closed
ppzzppz opened this issue Nov 26, 2019 · 4 comments
Closed

stack script needs network to work normally? #5103

ppzzppz opened this issue Nov 26, 2019 · 4 comments

Comments

@ppzzppz
Copy link

@ppzzppz ppzzppz commented Nov 26, 2019

The following file:

#!/usr/bin/env stack
{- stack --resolver global runghc
 --package process
 -}
{-# LANGUAGE OverloadedStrings #-}

main = do
  putStrLn "hello"

run command : stack xx.hs

Error reported in case of without network

HttpExceptionRequest Request {
  host                 = "mirrors.tuna.tsinghua.edu.cn"
  port                 = 80
  secure               = False
  requestHeaders       = [("Accept","application/json"),("User-Agent","The Haskell Stack")]
  path                 = "/stackage/snapshots.json"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 (ConnectionFailure Network.Socket.getAddrInfo (called with preferred socket type/protocol: AddrInfo {addrFlags = [AI_ADDRCONFIG], addrFamily = AF_UNSPEC, addrSocketType = Stream, addrProtocol = 0, addrAddress = <assumed to be undefined>, addrCanonName = <assumed to be undefined>}, host name: Just "mirrors.tuna.tsinghua.edu.cn", service name: Just "80"): does not exist (nodename nor servname provided, or not known))

expect: to work without network connection

@qrilka

This comment has been minimized.

Copy link
Contributor

@qrilka qrilka commented Nov 26, 2019

@ppzzppz this seems to be an bug with an easy fix if the point is about the global resolver, see https://github.com/commercialhaskell/stack/blob/stable/src/Stack/Config.hs#L153 - snapshots are not used for the ARGlobal value.
PR with a fix will be welcomed.

@ppzzppz

This comment has been minimized.

Copy link
Author

@ppzzppz ppzzppz commented Nov 27, 2019

I have tried and find that only “resolver global” doesn’t meet our expectation. The problem doesn’t seem too difficult, and I will try to fix

@qrilka

This comment has been minimized.

Copy link
Contributor

@qrilka qrilka commented Nov 27, 2019

Much appreciated, let me know if I could help with it

ppzzppz pushed a commit to ppzzppz/stack that referenced this issue Nov 28, 2019
ppzzppz pushed a commit to ppzzppz/stack that referenced this issue Nov 28, 2019
@snoyberg

This comment has been minimized.

Copy link
Contributor

@snoyberg snoyberg commented Jan 7, 2020

Resolved by #5104, thanks!

@snoyberg snoyberg closed this Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.