Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork940
Commitd779a75
committed
Don't assume WSL-related bash.exe error is English
Instead of searching for an English sentence from the errormessage, this searches for the specific aka.ms short URL itcontains in all languages, which points to a page about downloadingdistributions for WSL from the Microsoft Store (Windows Store).The URL is controlled and hosted by Microsoft and intended as apermalink. Thus this approach should be more reliable even forEnglish, as the specific wording of the message might be rephrasedover time, so this may have a lower risk of false negatives.Because it only makes sense to give a link for obtaining adistribution in an error message when no distribution is installedalready, the risk of false positives should also be fairly low.The URL is included in the output telling the user they have nodistributions installed even on systems like Windows Server wherethe Microsoft Store is not itself available, and even in situationswhere WSL has successfully downloaded and unpacked a distributionbut could not run it the first time because it is using WSL 2 butthe necessary virtualization is unavailable. Because these areincluded among the situations where the hook tests should be markedxfail, it is suitable for the purpose at hand.Furthermore, while this only works if we correctly guess if theencoding is UTF-16LE or not, it should be *fairly* robust againstincorrect decoding of the message where a single-byte encoding istreated as UTF-8, or UTF-8 is treated as a single-byte encoding, orone single-byte encoding is treated as another (i.e., wrong ANSIcode page). But some related encoding subtleties remain to beresolved.Although reliability is likely improved even for English, tofaciliate debugging the WslNoDistro case now carries analogous`process` and `message` arguments to the `CheckError` case.On some Windows systems, wsl.exe exists in System32 but bash.exedoes not. This is not inherently a problem for run_commit_hook asit currently stands, which is just trying to use whatever bash.exeis available. (It is not clear that WSL should be preferred.) Thisis currently so, on some systems, where WSL is not really set up;wsl.exe can be used to do so. This is a situation where no WSLdistributions are present, but because the bash.exe WSL wrapper isalso absent, it is not a problem.However, I had wrongly claimed in the _WinBashStatus.checkdocstring that bash.exe is in System32 whenever WSL is present. Sothis also revises the docstring to say only that this is usually so(plus some further revision for clarity).1 parent496acaa commitd779a75
1 file changed
+12
-12
lines changedLines changed: 12 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
| 11 | + | |
11 | 12 |
| |
12 | 13 |
| |
13 | 14 |
| |
| |||
58 | 59 |
| |
59 | 60 |
| |
60 | 61 |
| |
61 |
| - | |
| 62 | + | |
62 | 63 |
| |
63 | 64 |
| |
64 | 65 |
| |
| |||
80 | 81 |
| |
81 | 82 |
| |
82 | 83 |
| |
83 |
| - | |
84 |
| - | |
85 |
| - | |
86 |
| - | |
87 |
| - | |
88 |
| - | |
89 |
| - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
90 | 91 |
| |
91 | 92 |
| |
92 | 93 |
| |
93 | 94 |
| |
94 | 95 |
| |
95 |
| - | |
96 |
| - | |
97 | 96 |
| |
98 | 97 |
| |
99 | 98 |
| |
| |||
106 | 105 |
| |
107 | 106 |
| |
108 | 107 |
| |
| 108 | + | |
109 | 109 |
| |
110 | 110 |
| |
111 | 111 |
| |
112 |
| - | |
113 |
| - | |
| 112 | + | |
| 113 | + | |
114 | 114 |
| |
115 | 115 |
| |
116 | 116 |
| |
|
0 commit comments
Comments
(0)