Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/provider-bridge-acp/src/bridge/fake-acp-agent.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
*/

import { createInterface } from "node:readline";
import { appendFileSync, writeFileSync } from "node:fs";
import { appendFileSync, renameSync, writeFileSync } from "node:fs";

const failLoad = process.env.FAKE_ACP_FAIL_LOAD === "1";
const loadSession = process.env.FAKE_ACP_LOAD_SESSION === "1" || failLoad;
Expand Down Expand Up @@ -144,7 +144,12 @@ for (let i = fakeModels.length; i < modelCount; i += 1) {

process.on("SIGTERM", () => {
if (process.env.FAKE_ACP_SIGNAL_FILE) {
writeFileSync(process.env.FAKE_ACP_SIGNAL_FILE, "SIGTERM\n");
const signalFile = process.env.FAKE_ACP_SIGNAL_FILE;
const stagedSignalFile = `${signalFile}.${process.pid}.tmp`;
// The final path is the test's completion boundary: publish it only after
// the marker bytes are complete.
writeFileSync(stagedSignalFile, "SIGTERM\n");
renameSync(stagedSignalFile, signalFile);
}
process.exit(0);
});
Expand Down
Loading