* Returns the operating system context. * * Based on the current platform, this uses a different strategy to provide the * most accurate OS information. Since this might involve spawning subprocesses * or accessing the file system, this should only be executed lazily and cached. * * - On macO
()
| 262 | * that `version` might actually be the kernel version. |
| 263 | */ |
| 264 | async function getOsContext(): Promise<OsContext> { |
| 265 | const platformId = os.platform(); |
| 266 | switch (platformId) { |
| 267 | case 'darwin': |
| 268 | return getDarwinInfo(); |
| 269 | case 'linux': |
| 270 | return getLinuxInfo(); |
| 271 | default: |
| 272 | return { |
| 273 | name: PLATFORM_NAMES[platformId] || platformId, |
| 274 | version: os.release(), |
| 275 | }; |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | function getCultureContext(): CultureContext | undefined { |
| 280 | try { |
no test coverage detected