Patch du jour for python-packages/adb/device.py
This file contains 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
| # Encode the PowerShell command as base64 and use the special | |
| # -EncodedCommand option that base64 decodes. Base64 is just plain ASCII, | |
| # so it should have no problem passing through Win32 CreateProcessA() | |
| # (which python erroneously calls instead of CreateProcessW()). | |
| return (['powershell.exe', '-NoProfile', '-NonInteractive', | |
| + '-InputFormat', 'None', # NOTE(FG): fixes running from Cygwin | |
| '-EncodedCommand', base64.b64encode(ps_code)],) + args[1:] | |
| def get_props(self): | |
| result = {} | |
| output, _ = self.shell(['getprop']) | |
| output = split_lines(output) | |
| pattern = re.compile(r'^\[([^]]+)\]: \[(.*)\]') | |
| for line in output: | |
| match = pattern.match(line) | |
| if match is None: | |
| + # NOTE(fg): Meizu phone has line breaks in a few of the props; just ignore them | |
| + # instead of shutting down. | |
| - raise RuntimeError('invalid getprop line: "{}"'.format(line)) | |
| + #raise RuntimeError('invalid getprop line: "{}"'.format(line)) | |
| + continue | |
| key = match.group(1) | |
| value = match.group(2) | |
| if key in result: | |
| raise RuntimeError('duplicate getprop key: "{}"'.format(key)) | |
| result[key] = value | |
| return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment