Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

test(native-ssh): walk the downloaded tree from the listing's own entry types

reviewfce2ae5fd711
diff --git a/src/core/remote-ssh/native/native-invoke.test.ts b/src/core/remote-ssh/native/native-invoke.test.ts
index a111b9953..78ab39cc7 100644
--- a/src/core/remote-ssh/native/native-invoke.test.ts
+++ b/src/core/remote-ssh/native/native-invoke.test.ts
@@ -355,10 +355,12 @@ describe('download() — a remote tree onto a Windows filesystem', () => {
const files = (root: string): Record<string, string> => {
const out: Record<string, string> = {}
const walk = (d: string, rel: string): void => {
- for (const n of fs.readdirSync(d)) {
- const full = path.join(d, n)
- if (fs.statSync(full).isDirectory()) walk(full, `${rel}${n}/`)
- else out[`${rel}${n}`] = fs.readFileSync(full, 'utf8')
+ // The entry's type comes from the listing itself (no stat-then-read on the path — CodeQL
+ // js/file-system-race), which is also what a test over a temp tree needs.
+ for (const e of fs.readdirSync(d, { withFileTypes: true })) {
+ const full = path.join(d, e.name)
+ if (e.isDirectory()) walk(full, `${rel}${e.name}/`)
+ else out[`${rel}${e.name}`] = fs.readFileSync(full, 'utf8')
}
}
walk(root, '')