()
| 240 | let detectedEnvironment: Promise<Environment> | undefined; |
| 241 | |
| 242 | export function detectEnvironmentFromNode(): Promise<Environment> { |
| 243 | if (detectedEnvironment !== undefined) return detectedEnvironment; |
| 244 | const platform = process.platform; |
| 245 | const env = process.env as Record<string, string | undefined>; |
| 246 | const isFile = async (path: string): Promise<boolean> => { |
| 247 | try { |
| 248 | await access(path, fsConstants.F_OK); |
| 249 | return true; |
| 250 | } catch { |
| 251 | return false; |
| 252 | } |
| 253 | }; |
| 254 | detectedEnvironment = detectEnvironment({ |
| 255 | platform, |
| 256 | arch: process.arch, |
| 257 | release: nodeOs.release(), |
| 258 | env, |
| 259 | isFile, |
| 260 | execFileText, |
| 261 | }); |
| 262 | return detectedEnvironment; |
| 263 | } |
| 264 | |
| 265 | async function findExecutablesOnPath( |
| 266 | name: string, |
no test coverage detected