Decode as UTF-8 in ExitCodeException's Show instance#89
Draft
9999years wants to merge 2 commits intofpco:masterfrom
Draft
Decode as UTF-8 in ExitCodeException's Show instance#899999years wants to merge 2 commits intofpco:masterfrom
ExitCodeException's Show instance#899999years wants to merge 2 commits intofpco:masterfrom
Conversation
Split off of fpco#83. Before, `ProcessConfig`'s `Show` output would include a trailing newline. This has been fixed, so that derived `Show` output does not include newlines in weird places. Before: ghci> data Foo = Foo { a :: Int, b :: ProcessConfig () () (), c :: String } deriving Show ghci> Foo 1 (proc "echo" ["puppy"]) "doggy" Foo {a = 1, b = Raw command: echo puppy , c = "doggy"} After ghci> Foo 1 (proc "echo" ["puppy"]) "doggy" Foo {a = 1, b = Raw command: echo puppy, c = "doggy"} Whitespace for the `ExitCodeException` `Show` instance has also been adjusted, to place the output closer to the relevant headers. Before: ghci> readProcess_ $ proc "sh" ["-c", "echo this is stdout; echo this is stderr >&2; false"] *** Exception: Received ExitFailure 1 when running Raw command: sh -c "echo this is stdout; echo this is stderr >&2; false" Standard output: this is stdout Standard error: this is stderr After: *** Exception: Received ExitFailure 1 when running Raw command: sh -c "echo this is stdout; echo this is stderr >&2; false" Standard output: this is stdout Standard error: this is stderr Note that because trailing whitespace is not accounted for, it is still possible to get unintuitive results depending on what exactly the subprocess prints: ghci> readProcess_ $ proc "sh" ["-c", "echo -n this is stdout; echo -n this is stderr >&2; false"] *** Exception: Received ExitFailure 1 when running Raw command: sh -c "echo -n this is stdout; echo -n this is stderr >&2; false" Standard output: this is stdout Standard error: this is stderr
b105d12 to
c381613
Compare
Partial fix for fpco#86. This isn't perfect (for retrocomputing you may want another character encoding) but improves the behavior in many circumstances.
c381613 to
9fc7dc1
Compare
Collaborator
|
Could you please check whether #87 does what you want regarding UTF-8 decoding when formatting an |
Contributor
Author
|
This PR is a draft which requires #88, let's discuss this PR after that one is closed. |
Collaborator
|
I'd prefer to proceed directly to resolving the UTF-8 issue via #87, and would like to confirm you're content with that resolution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Partial fix for #86. This isn't perfect (for retrocomputing you may want another character encoding) but improves the behavior in many circumstances.
Requires #88.