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

spago init and then spago build throw hGetContents error #533

Closed
kakkun61 opened this issue Dec 29, 2019 · 5 comments · Fixed by #595
Closed

spago init and then spago build throw hGetContents error #533

kakkun61 opened this issue Dec 29, 2019 · 5 comments · Fixed by #595

Comments

@kakkun61
Copy link

kakkun61 commented Dec 29, 2019

I got spago.exe: fd:5: hGetContents: invalid argument (invalid byte sequence) when I ran the following commands.

> node init
> node install --save-dev purescript
> node install --save-dev spago
> npx spago init
> npx spago build
[info] Installing 4 dependencies.
[info] Searching for packages cache metadata..
[info] Unable to find packages cache metadata, downloading from GitHub..
[info] Installing and globally caching "psci-support"
[info] Installing and globally caching "console"
[info] Installing and globally caching "effect"
[info] Installing and globally caching "prelude"
[info] Installation complete.
spago.exe: fd:5: hGetContents: invalid argument (invalid byte sequence)
Tool Version
node 13.5.0
npm 6.13.4
purescript 0.13.5
spago 0.13.0
  • Windows 10 Home 1909
    • chcp 932
    • chcp 65001
@kakkun61
Copy link
Author

I think this is about the character code.

@kakkun61
Copy link
Author

kakkun61 commented Dec 29, 2019

I found that turtle's shellStrictWithErr throws this error called at following.

https://github.com/spacchetti/spago/blob/426838670ba9de4593f4c533a6947efb2d8ad4ba/src/Spago/Purs.hs#L121

@kakkun61
Copy link
Author

kakkun61 commented Dec 29, 2019

Removing the following line fixes this problem in my case.

https://github.com/spacchetti/spago/blob/426838670ba9de4593f4c533a6947efb2d8ad4ba/app/Spago.hs#L375

@kakkun61
Copy link
Author

I think that almost all commands output to the standard output with the local encoding which is Windows-31J in my case and that fixing UTF-8 is bad.

I think that with the standard input, the standard output, and the error output the local character code should be used and that with the file IO UTF-8 should be.

@f-f
Copy link
Member

f-f commented Jan 10, 2020

@kakkun61 sorry for delay in getting back to this and thanks for the detailed report 👏

Yes, I agree that fixing UTF-8 for all systems leads to bad things like this, but we had some issues when not fixing it as well, so the solution you propose might be the correct behaviour here!
However, it seems pretty hard to get right (mostly because we do piggyback on other executables to get things done, so we'd need to be careful in there too), and I think we'd need better tests on this.
I won't have time to look at this myself though, so I'll mark this as up for grabs

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

Successfully merging a pull request may close this issue.

2 participants