Skip to content

Commit

Permalink
Merge pull request #186 from CoshUS/issue/dotnet-encoding
Browse files Browse the repository at this point in the history
Changed dotnet Encoding to System Locale Dependent
  • Loading branch information
sriram-mv authored Aug 6, 2020
2 parents 4ff4077 + 29dbbfd commit 5d06f50
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ typings/
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.vscode

# Sensitive or high-churn files:

Expand Down
9 changes: 7 additions & 2 deletions aws_lambda_builders/workflows/dotnet_clipackage/dotnetcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import sys
import logging
import locale

from .utils import OSUtils

Expand Down Expand Up @@ -49,14 +50,18 @@ def run(self, args, cwd=None):

LOG.debug("executing dotnet: %s", invoke_dotnet)

# DotNet output is in system locale dependent encoding
# https://docs.microsoft.com/en-us/dotnet/api/system.console.outputencoding?view=netcore-3.1#remarks
# "The default code page that the console uses is determined by the system locale."
encoding = locale.getpreferredencoding()
p = self.os_utils.popen(invoke_dotnet, stdout=self.os_utils.pipe, stderr=self.os_utils.pipe, cwd=cwd)

out, err = p.communicate()

# The package command contains lots of useful information on how the package was created and
# information when the package command was not successful. For that reason the output is
# always written to the output to help developers diagnose issues.
LOG.info(out.decode("utf8").strip())
LOG.info(out.decode(encoding).strip())

if p.returncode != 0:
raise DotnetCLIExecutionError(message=err.decode("utf8").strip())
raise DotnetCLIExecutionError(message=err.decode(encoding).strip())
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_must_build_python_project_through_makefile(self):
"chardet",
"urllib3",
"idna",
"urllib3-1.25.9.dist-info",
"urllib3-1.25.10.dist-info",
"chardet-3.0.4.dist-info",
"certifi-2020.4.5.2.dist-info",
"certifi",
Expand Down

0 comments on commit 5d06f50

Please sign in to comment.