import{readFileSync as e}from"node:fs";import t from"node:fs/promises";let n=null;function r(){return!!(process.env.WSL_INTEROP||process.env.WSL_DISTRO_NAME||process.env.WSLENV)}function i(){if(process.platform!==`linux`)return!1;if(r())return!0;try{let t=e(`/proc/version`,`utf8`).toLowerCase();return t.includes(`microsoft`)||t.includes(`wsl`)}catch{return!1}}function a(){if(!i())return!1;try{let t=e(`/proc/version`,`utf8`).toLowerCase();return t.includes(`wsl2`)||t.includes(`microsoft-standard`)}catch{return!1}}async function o(){if(n!==null)return n;if(process.platform!==`linux`)return n=!1,n;if(r())return n=!0,n;try{let e=await t.readFile(`/proc/sys/kernel/osrelease`,`utf8`);n=e.toLowerCase().includes(`microsoft`)||e.toLowerCase().includes(`wsl`)}catch{n=!1}return n}export{a as n,r,o as t};
