| 20222 | if (!tool) { |
| 20223 | throw new Error("parameter 'tool' is required"); |
| 20224 | } |
| 20225 | const extensions = []; |
| 20226 | if (IS_WINDOWS && process.env["PATHEXT"]) { |
| 20227 | for (const extension of process.env["PATHEXT"].split(path2.delimiter)) { |
| 20228 | if (extension) { |
| 20229 | extensions.push(extension); |
| 20230 | } |
| 20231 | } |
| 20232 | } |
| 20233 | if (isRooted(tool)) { |
| 20234 | const filePath = yield tryGetExecutablePath(tool, extensions); |
| 20235 | if (filePath) { |
| 20236 | return [filePath]; |
| 20237 | } |
| 20238 | return []; |
| 20239 | } |
| 20240 | if (tool.includes(path2.sep)) { |
| 20241 | return []; |
| 20242 | } |
| 20243 | const directories = []; |
| 20244 | if (process.env.PATH) { |
| 20245 | for (const p of process.env.PATH.split(path2.delimiter)) { |
| 20246 | if (p) { |
| 20247 | directories.push(p); |
| 20248 | } |
| 20249 | } |
| 20250 | } |
| 20251 | const matches = []; |
| 20252 | for (const directory of directories) { |