Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Windows codepage bugfix #899

Merged
merged 4 commits into from
Sep 26, 2019
Merged

Windows codepage bugfix #899

merged 4 commits into from
Sep 26, 2019

Conversation

PeterWone
Copy link
Contributor

@PeterWone PeterWone commented Sep 24, 2019

See #869

When the path on a Windows machine is broken in such a way that chcp cannot be successfully invoked, an error occurs and the returned reason object does not have a code property as expected by the error handler. This results in the unhelpful error message code=undefined

There are two problems here:

  • defective error handling
  • weak handling of a scenario for which there is a reasonable default

Improved error handling

The catch clause checks whether code or message properties are present and falls back to stringifying the whole object.

Reasonable default

The code page is 850 for the English speaking world. When a value cannot be obtained and the default is used a warning is generated that includes the error message returned from the attempt to invoke chcp.

@msftclas
Copy link

msftclas commented Sep 24, 2019

CLA assistant check
All CLA requirements met.

@dooriya dooriya mentioned this pull request Sep 26, 2019
@dooriya dooriya merged commit ebd03db into microsoft:master Sep 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants