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

Fix unicode issues with shortcuts.run #127

Closed

Conversation

rohanpm
Copy link
Member

@rohanpm rohanpm commented Oct 3, 2019

Merge request includes fixes for:

lubomir and others added 3 commits October 2, 2019 10:00
When there is an incomplete multibyte sequence, process the data only
until the start of this sequence. When next chunk is read, prepend the
left overs to it. This should complete the sequence and processing
should continue normally.

Fixes: release-engineering#119
universal_newlines is only one of several arguments which activate
text mode with Popen; make sure we support all of them (otherwise
crashes occur when those arguments are passed).

Rather than catching decoding errors and keeping track of remaining
data explicitly, let's use a stream reader class designed for that
purpose.

Let's document the behavior that the process must always output
UTF-8.

Fixes release-engineering#126
@rohanpm
Copy link
Member Author

rohanpm commented Oct 3, 2019

I was playing around with an alternative solution for #120, but looks like it needs more attention on the log file handling.

@lubomir
Copy link
Contributor

lubomir commented Oct 3, 2019

With this patch the output of the command would always be decoded as UTF-8. That might break some use-cases. With current code it should be possible to run commands that return even binary data as long as output=False. I don't know if someone is doing that. The code that triggered #119 was not using text mode only by mistake.

Your approach has the advantage that the log file could be opened in text mode unconditionally and you would always send unicode to it. Currently it's trying to match the Proc object, which brings a lot of complexity.

@rohanpm
Copy link
Member Author

rohanpm commented Jan 10, 2020

Not planning to proceed with this.

@rohanpm rohanpm closed this Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants