GeezerVison is showing github.com — test: deflake shutdown-deadline cleanup and PowerShell permission tim… · abn/opencode@5f1f8d0
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/cli/test/shutdown-deadline.test.ts +7-7Lines changed: 7 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -46,7 +46,7 @@ async function hang( |
46 | 46 | await body(proc, pid) |
47 | 47 | } finally { |
48 | 48 | proc.kill("SIGKILL") |
49 | | - if (running(pid)) process.kill(pid, "SIGKILL") |
| 49 | + kill(pid) |
50 | 50 | } |
51 | 51 | } |
52 | 52 |
|
@@ -63,12 +63,12 @@ async function readLine(stream: ReadableStream<Uint8Array>, prefix: string) { |
63 | 63 | } |
64 | 64 | } |
65 | 65 |
|
66 | | -function running(pid: number) { |
67 | | - if (!Number.isSafeInteger(pid) || pid <= 0) return false |
| 66 | +// The fixture's child can exit between any liveness check and the kill, so a missing process is not an error. |
| 67 | +function kill(pid: number) { |
| 68 | + if (!Number.isSafeInteger(pid) || pid <= 0) return |
68 | 69 | try { |
69 | | - process.kill(pid, 0) |
70 | | - return true |
71 | | - } catch { |
72 | | - return false |
| 70 | + process.kill(pid, "SIGKILL") |
| 71 | + } catch (error) { |
| 72 | + if ((error as NodeJS.ErrnoException).code !== "ESRCH") throw error |
73 | 73 | } |
74 | 74 | } |
Collapse file
Copy file name to clipboardExpand all lines: packages/core/test/tool-shell.test.ts +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -257,6 +257,7 @@ const withScanner = <A, E, R>( |
257 | 257 | (tmp) => Effect.promise(() => tmp[Symbol.asyncDispose]().then(() => undefined)), |
258 | 258 | ) |
259 | 259 |
|
| 260 | +// The timeout catches a hung permission flow, not slowness: PowerShell commands on loaded Windows runners have exceeded 5s. |
260 | 261 | const runPermissionCommand = ( |
261 | 262 | registry: Tool.Interface, |
262 | 263 | command: string, |
@@ -287,7 +288,7 @@ const runPermissionCommand = ( |
287 | 288 | expect(yield* permission.list()).toEqual([]) |
288 | 289 | expect(yield* Queue.size(queue)).toBe(0) |
289 | 290 | return { exit, requests } |
290 | | - }).pipe(Effect.scoped, Effect.timeout(Duration.seconds(5))) |
| 291 | + }).pipe(Effect.scoped, Effect.timeout(Duration.seconds(15))) |
291 | 292 |
|
292 | 293 | // Directory cases still document inherited limitations; fixed scanner cases require matching behavior. |
293 | 294 | describe("ShellTool scanner permissions", () => { |
|