History

Resolve mock process on timeout cleanup

Cursor Agent committed 6 months ago

Commit d8ec10a1 parent f30413f1 file · +11 −2Browse files

Unified · Split

packages/tailscale/src/tailscale.test.ts+11−2
@@ -40,11 +40,20 @@ function mockHandle(result: { stdout?: string; stderr?: string; code?: number }) · 39 unmodified lines
40}40}
41 41
42function mockNeverFinishingHandle() {42function mockNeverFinishingHandle() {
43 let finish: ((exitCode: ChildProcessSpawner.ExitCode) => void) | null = null;
43 return ChildProcessSpawner.makeHandle({44 return ChildProcessSpawner.makeHandle({
44 pid: ChildProcessSpawner.ProcessId(1),45 pid: ChildProcessSpawner.ProcessId(1),
45 exitCode: Effect.never,46 exitCode: Effect.callback<ChildProcessSpawner.ExitCode>((resume) => {
47 finish = (exitCode) => resume(Effect.succeed(exitCode));
48 return Effect.sync(() => {
49 finish = null;
50 });
51 }),
46 isRunning: Effect.succeed(true),52 isRunning: Effect.succeed(true),
47 kill: () => Effect.void,53 kill: () =>
54 Effect.sync(() => {
55 finish?.(ChildProcessSpawner.ExitCode(143));
56 }),
48 unref: Effect.succeed(Effect.void),57 unref: Effect.succeed(Effect.void),
49 stdin: Sink.drain,58 stdin: Sink.drain,
50 stdout: Stream.empty,59 stdout: Stream.empty,