mirror of
https://github.com/morluto/rea.git
synced 2026-11-23 23:15:58 +00:00
15 lines
419 B
TypeScript
15 lines
419 B
TypeScript
import { open, stat } from "node:fs/promises";
|
|
|
|
/** Probe the host prerequisite separately from the dconf reader under test. */
|
|
export const hasReadableProcDescriptor = async (): Promise<boolean> => {
|
|
const handle = await open(new URL(import.meta.url), "r");
|
|
try {
|
|
await stat(`/proc/${process.pid}/fd/${handle.fd}`);
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
} finally {
|
|
await handle.close();
|
|
}
|
|
};
|