parent-death-guard-shared-host.ts 533 B

12345678910111213
  1. import { createLocalBashOperations } from "../../src/core/tools/bash.ts";
  2. const firstMarker = process.argv[2];
  3. const secondMarker = process.argv[3];
  4. if (!firstMarker || !secondMarker) throw new Error("two marker file arguments are required");
  5. const operations = createLocalBashOperations({ parentDeathGuard: true });
  6. const run = (marker: string) =>
  7. operations.exec(`echo $$ > "${marker}"; while true; do sleep 0.1; done`, process.cwd(), {
  8. onData: () => undefined,
  9. });
  10. await Promise.all([run(firstMarker), run(secondMarker)]);