Files
rea/tests/fixtures/retainedRuntimeNode.ts
T
gensokyo-dev cc8835c7a3 fix(tests): stabilize process fixtures and malformed input coverage (#6570)
Preserve renamed-executable identity, complete-line readiness and bounded child lifetimes. Use genuinely malformed Inspector input and explicit ADB file-probe/push/hash facts while preserving cancellation, cleanup, Evidence and completeness assertions. Adopt current main Go fixtures and retain malformed COFF coverage.

Fixes #6556
Refs #6480
2026-10-23 10:39:28 +00:00

17 lines
788 B
TypeScript

import { constants } from "node:fs";
import { chmod, copyFile, symlink } from "node:fs/promises";
/** A controlled Node child announces readiness and expires even if its PID is never received. */
export const retainedRuntimeNodeCode = (displayName?: string): string =>
`${displayName === undefined ? "" : `process.title = ${JSON.stringify(displayName)}; `}setTimeout(() => process.exit(0), 30_000); process.send('ready');`;
/** Give the fixture a distinct executable identity without relying on host multicall utilities. */
export const prepareRenamedNodeLauncher = async (
launcher: string,
alternate: string,
): Promise<void> => {
await copyFile(process.execPath, launcher, constants.COPYFILE_FICLONE);
await chmod(launcher, 0o700);
await symlink(launcher, alternate);
};