You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bac4890
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: scripts/installer-windows.mjs
+10-5Lines changed: 10 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -195,11 +195,16 @@ function findWindowsCommand(env, name = "pnpm") {
195
195
constpath=value("path");
196
196
constpathExt=value("pathext");
197
197
if(typeofpath!=="string"||typeofpathExt!=="string")thrownewError("Unknown Windows PATH/PATHEXT");
198
-
constextensions=pathExt.toLowerCase().split(";");
199
-
// .cpl is known because Windows PowerShell 5.1 appends it for its children, and
200
-
// bootstrap.cmd starts this helper from there. Known is not accepted: a .cpl (or
201
-
// any non-.cmd wrapper / non-.exe Node) found first still fails closed below.
202
-
if(!extensions.length||newSet(extensions).size!==extensions.length||extensions.some((extension)=>!/^\.(com|exe|bat|cmd|vbs|vbe|js|jse|wsf|wsh|msc|cpl)$/.test(extension)))thrownewError("Unknown Windows PATHEXT semantics");
198
+
// Validate before lowercasing: case folding can map non-ASCII (U+212A KELVIN SIGN)
199
+
// onto ASCII and make a different name look like a known extension.
200
+
constentries=pathExt.split(";");
201
+
if(entries.some((extension)=>!/^\.[A-Za-z0-9]+$/.test(extension)))thrownewError("Unknown Windows PATHEXT semantics");
// Any well-formed extension is resolved in its PATHEXT place, like CMD does:
204
+
// Windows PowerShell 5.1 appends .CPL, Python adds .PY and .PYW (#1978), other
205
+
// runtimes add their own. Resolved is not accepted: a .cpl, .py (or any
206
+
// non-.cmd wrapper / non-.exe Node) found first still fails closed below.
207
+
if(!extensions.length||newSet(extensions).size!==extensions.length||extensions.some((extension)=>!/^\.[a-z0-9]+$/.test(extension)))thrownewError("Unknown Windows PATHEXT semantics");
203
208
// CMD ignores empty entries (a trailing `;` is the Windows default); every
204
209
// other non-absolute, quoted or UNC entry still fails closed.
0 commit comments