import e from"node:fs";function t(e){return Number.isInteger(e)&&e>0}function n(t){if(process.platform!==`linux`)return!1;try{return e.readFileSync(`/proc/${t}/status`,`utf8`).match(/^State:\s+(\S)/m)?.[1]===`Z`}catch{return!1}}function r(e){if(!t(e))return!1;try{process.kill(e,0)}catch{return!1}return!n(e)}function i(n){if(process.platform!==`linux`||!t(n))return null;try{let t=e.readFileSync(`/proc/${n}/stat`,`utf8`),r=t.lastIndexOf(`)`);if(r<0)return null;let i=t.slice(r+1).trimStart().split(/\s+/),a=Number(i[19]);return Number.isInteger(a)&&a>=0?a:null}catch{return null}}function a(e){let t=process,n=t[e];if(n)return n;let r=new Map;return t[e]=r,r}export{i as n,r,a as t};