Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork939
Commit496acaa
committed
Handle multiple encodings for WSL error messages
This affects the test suite only. It improves _WinBashStatus.When bash.exe is the WSL wrapper, and it reports an error thatprevents bash in a WSL system from ever actually being run, themessage may be encoded in a narrow or multibyte encoding, or mayinstead be in Windows's native UTF-16LE encoding. This was partlyhandled before, by assuming the message indicating the absence ofany installed WSL distribuions could be interpreted as UTF-8, butmatching against bytes and not actually decoding it or other errormessages. That presented a few problems, which are rememedied here:- It turns out that this "Windows Subsystem for Linux has no installed distributions" message actually can be in UTF-16LE too. This happens when it is part of a message that also reports a textual error code like: Bash/Service/CreateInstance/GetDefaultDistro/WSL_E_DEFAULT_DISTRO_NOT_FOUND Therefore, narrow-encoding matching was not sufficient.- Logged messages were hard to understand, because they were printing the reprs of bytes objects, which sometimes were UTF-16LE and thus had many "\x00" interspersed in them.- The cases were not broken down elegantly. The ErrorWhileChecking case could hold a CompletedProcess, a CalledProcessError, or an OSError. This is now replaced with a WinError case for the rare scenario where CreateProcessW fails in a completely unexpected way, and a CheckError case for when the exit status or output of bash.exe indicates an error other than one we want to handle. CheckError has two attributes: `process` for the CompletedProcess (CalledProcessError is no longer used, and CompletedProcess has `returncode` and other attributes that provide the same info), and `message` for the decoded output.1 parentd5ed266 commit496acaa
1 file changed
+20
-24
lines changedLines changed: 20 additions & 24 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
64 |
| - | |
65 |
| - | |
| 64 | + | |
| 65 | + | |
66 | 66 |
| |
67 |
| - | |
68 |
| - | |
69 |
| - | |
70 |
| - | |
| 67 | + | |
| 68 | + | |
71 | 69 |
| |
72 | 70 |
| |
73 | 71 |
| |
| |||
94 | 92 |
| |
95 | 93 |
| |
96 | 94 |
| |
97 |
| - | |
98 |
| - | |
99 |
| - | |
100 |
| - | |
101 |
| - | |
102 |
| - | |
| 95 | + | |
103 | 96 |
| |
104 | 97 |
| |
105 | 98 |
| |
106 | 99 |
| |
107 | 100 |
| |
108 | 101 |
| |
109 | 102 |
| |
110 |
| - | |
| 103 | + | |
111 | 104 |
| |
112 | 105 |
| |
113 | 106 |
| |
114 |
| - | |
115 |
| - | |
116 |
| - | |
117 |
| - | |
118 |
| - | |
119 |
| - | |
120 |
| - | |
121 |
| - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
122 | 118 |
| |
123 |
| - | |
| 119 | + | |
124 | 120 |
| |
125 |
| - | |
126 |
| - | |
| 121 | + | |
| 122 | + | |
127 | 123 |
| |
128 | 124 |
| |
129 | 125 |
| |
|
0 commit comments
Comments
(0)