You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
without a network connection, stack new just fails to download a template, even though the template already exists in the template directory.
Expected
stack new try to download (update ? refresh cache ?) the template, but fallback to the existing template
ls ~/.stack/templates/ -lh
total 8.0K
-rw-------. 1 user user 3.8K Feb 5 18:58 new-template.hsfiles
-rw-------. 1 user user 42 Feb 5 18:58 new-template.hsfiles.etag
Actual
$ stack new bla
Downloading template "new-template" to create project "bla" in bla/ ...
Warning: Retry number 0 after a total delay of 0 us
....
Warning: Retry number 3 after a total delay of 300000 us
If you see this warning and stack fails to download, but running the command again solves the problem, please report here:
https://github.com/commercialhaskell/stack/issues/3510
HttpExceptionRequest Request {
host = "raw.githubusercontent.com"
port = 443
secure = True
requestHeaders = [("If-None-Match","\"20199ac22a46c1b88a1e7e93f6555f4243430c44\"")]
path = "/commercialhaskell/stack-templates/master/new-template.hsfiles"
queryString = ""
method = "GET"
proxy = Nothing
rawBody = False
redirectCount = 10
responseTimeout = ResponseTimeoutDefault
requestVersion = HTTP/1.1
}
(ConnectionFailure Network.Socket.getAddrInfo: does not exist (Try again))
Hi, I'm sort of a beginner to Haskell and since this issue was marked newcomer friendly I hope I can contribute. Can you @mgsloan@vincenthz give an overview of what has to be done, it would be helpful.
@sudsj Hi, sounds good! There are a few ways this could be implemented. I think it would be best to have it do the following:
When downloading templates, always store in $STACK_ROOT/templates-cache. Should use Network.HTTP.Download.redownload. Then, load from the stored file.
If that function throws RedownloadFailed, then display a message to the user that the download failed and the template might not be up-to-date. Then proceed to load it anyway from the stored file if one exists.
An alternative approach might be to have it clone the templates repo and attempt to do a fetch. This has some nice benefits, but would probably be more complicated. Up to you which approach is taken!
General summary/comments (optional)
without a network connection,
stack new
just fails to download a template, even though the template already exists in the template directory.Expected
stack new
try to download (update ? refresh cache ?) the template, but fallback to the existing templateActual
Stack version
The text was updated successfully, but these errors were encountered: