How to get OS from extension?

What’s the right way to get the operating system from within an extension?

I tried all the methods suggested by StackOverflow.

In particular,

import * as os from 'os';

The module os doesn’t exist, and trying yarn install to install it (from within my local node installation) breaks jlpm.

On the other hand, process.platform returns undefined

There probably isn’t a right answer for this, due to the Jupyter architecture: there’s no guarantee a client’s browser is running on the same platform as the server is running on the same platform as the kernel.

Indeed, browsers are fairly resistant to giving that nugget of information up, and even make “which browser” hard, though some workarounds are possible.

For the server, one can use various PageConfig paths to at least detect whether something is POSIX-like, but it will also not give up that information directly.

For a kernel, one would have to get a handle to and then ask the kernel by executing arbitrary code.

Ok, would need to find another solution then, I need to escape a string if the kernel (I guess?) it’s running on Windows