* gVisor reports kernel string `4.19.0-gvisor` (current) or `4.4.0` (legacy * Sentry kernel). * * `4.19.0-gvisor` is unambiguous — no real Linux box reports that string. * `4.4.0` collides with Ubuntu 16.04 LTS / older real kernels, so we only * accept it as a gVisor signal when /proc/version A
()
| 257 | * accept it as a gVisor signal when /proc/version ALSO contains "gVisor". |
| 258 | */ |
| 259 | function isGVisor(): boolean { |
| 260 | const kernel = release(); |
| 261 | if (kernel.includes("gvisor")) return true; |
| 262 | if (platform() !== "linux") return false; |
| 263 | try { |
| 264 | const procVersion = readFileSync("/proc/version", "utf-8"); |
| 265 | return procVersion.includes("gVisor"); |
| 266 | } catch { |
| 267 | return false; |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | function isDocker(): boolean { |
| 272 | if (existsSync("/.dockerenv")) return true; |
no test coverage detected