Skip to content

Commit 3c6d27f

Browse files
test(server): wait for the SIGTERM trap before ending the hung git command
The 200 ms timeout could fire before the shell installed its trap on a loaded host, so the test could pass without exercising the force-kill. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent bc84a59 commit 3c6d27f

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

‎apps/server/src/vcs/GitVcsDriverCore.test.ts‎

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,17 +1013,27 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
10131013
const fileSystem = yield* FileSystem.FileSystem;
10141014
const markerPath = pathService.join(yield* makeTmpDir(), "outlived-timeout");
10151015
const driver = yield* GitVcsDriver.GitVcsDriver;
1016+
const trapped = yield* Deferred.make<void>();
10161017

1017-
const error = yield* TestClock.withLive(
1018-
driver.execute({
1018+
const command = yield* driver
1019+
.execute({
10191020
operation: "GitVcsDriver.test.ignoresSigterm",
10201021
cwd,
1021-
args: ["-c", `alias.hang=!trap '' TERM; sleep 3; touch '${markerPath}'`, "hang"],
1022-
timeoutMs: 200,
1023-
}),
1024-
).pipe(Effect.flip);
1022+
args: [
1023+
"-c",
1024+
`alias.hang=!trap '' TERM; echo trapped; sleep 3; touch '${markerPath}'`,
1025+
"hang",
1026+
],
1027+
progress: {
1028+
onStdoutLine: (line) =>
1029+
line === "trapped" ? Deferred.succeed(trapped, undefined) : Effect.void,
1030+
},
1031+
})
1032+
.pipe(Effect.forkChild);
1033+
yield* Deferred.await(trapped);
1034+
// The driver's timeout ends a command the same way: by interrupting it.
1035+
yield* Fiber.interrupt(command);
10251036

1026-
assert.equal(error.detail, "Git command timed out.");
10271037
assert.isFalse(
10281038
yield* fileSystem.exists(markerPath),
10291039
"the timed-out git command kept running until it finished on its own",

0 commit comments

Comments
 (0)