mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-08-28 08:35:57 +00:00
19 lines
591 B
TypeScript
19 lines
591 B
TypeScript
/**
|
|
* Paths that are universally safe and should never trigger external-directory checks.
|
|
* These are OS device files: read returns EOF or process streams, write discards or goes to process streams.
|
|
*/
|
|
export const SAFE_SYSTEM_PATHS: ReadonlySet<string> = new Set([
|
|
"/dev/null",
|
|
"/dev/stdin",
|
|
"/dev/stdout",
|
|
"/dev/stderr",
|
|
]);
|
|
|
|
/**
|
|
* Returns true if the given normalized path is a safe OS device file
|
|
* that should never trigger external-directory checks.
|
|
*/
|
|
export function isSafeSystemPath(normalizedPath: string): boolean {
|
|
return SAFE_SYSTEM_PATHS.has(normalizedPath);
|
|
}
|