Skip to content

decode binary string as utf-8 in win branch#18974

Closed
bitcloud wants to merge 1 commit intoAzure:devfrom
bitcloud:container-exec-issue-win
Closed

decode binary string as utf-8 in win branch#18974
bitcloud wants to merge 1 commit intoAzure:devfrom
bitcloud:container-exec-issue-win

Conversation

@bitcloud
Copy link
Contributor

Description
The websocket response can be a string for text or bytes for an utf-8 string. utf-8 was not handled properly. This pr adds detection of bytes and decoding as utf-8 string before writing to the console.
This is the same fix as #18384 applied to the windows code as well.

Fixes: #18251 (comment)

Testing Guide

  • start a container e.g. with az container create with a long living container on a Windows system
  • try to execute a shell inside the container with az container exec --exec-command "/bin/bash" ...
  • currently it just exits without an error or shell

History Notes
[container] az container exec: decode received bytes as utf-8 string (Windows as well now)


This checklist is used to make sure that common guidelines for a pull request are followed.

@ghost ghost added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Jul 23, 2021
@ghost
Copy link

ghost commented Jul 23, 2021

Thank you for your contribution bitcloud! We will review the pull request and get back to you soon.

@bitcloud
Copy link
Contributor Author

I couldn't test this patch as I don't have a Windows system at hand. But it should work as it seems to be the same issue we had on the linux/macos code path.

@bitcloud
Copy link
Contributor Author

There seems to be a better PR already on the way: #18909

@bitcloud bitcloud closed this Jul 23, 2021
@bitcloud bitcloud deleted the container-exec-issue-win branch July 23, 2021 09:03
@bitcloud bitcloud restored the container-exec-issue-win branch July 23, 2021 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az container exec - does not work again - TypeError: write() argument must be str, not bytes

1 participant

Comments