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

Use en_US.UTF-8 for pure nix mode #4294

Merged
merged 1 commit into from
Sep 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ Other enhancements:
e.g. `stack unpack packagename`.
* Git repos are shared across multiple projects. See
[#3551](https://github.com/commercialhaskell/stack/issues/3551)
* Use en_US.UTF-8 locale by default in pure Nix mode so programs won't
crash because of Unicode in their output
[#4095](https://github.com/commercialhaskell/stack/issues/4095)

Bug fixes:

Expand Down
2 changes: 2 additions & 0 deletions src/Stack/Nix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ runShellAndExit mprojectRoot getCompilerVersion getCmdArgs = do
,"LD_LIBRARY_PATH = libPath;" -- LD_LIBRARY_PATH is set because for now it's
-- needed by builds using Template Haskell
,"STACK_IN_NIX_EXTRA_ARGS = stackExtraArgs; "
-- overriding default locale so Unicode output using base won't be broken
,"LANG=\"en_US.UTF-8\";"
,"} \"\""]]
-- glibcLocales is necessary on Linux to avoid warnings about GHC being incapable to set the locale.
fullArgs = concat [if pureShell then ["--pure"] else []
Expand Down
6 changes: 6 additions & 0 deletions test/integration/tests/4095-utf8-pure-nix/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import StackTest

main :: IO ()
main = do
stack ["build", "--nix-pure"]
stack ["exec", "--nix-pure", "ShowUnicode"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import System.IO (stdout)
import Text.Printf (hPrintf)

main :: IO ()
main = hPrintf stdout "平和"
4 changes: 4 additions & 0 deletions test/integration/tests/4095-utf8-pure-nix/files/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
executables:
ShowUnicode:
dependencies: [base]
main: ShowUnicode.hs
1 change: 1 addition & 0 deletions test/integration/tests/4095-utf8-pure-nix/files/stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
resolver: lts-11.19