Skip to content

The agent that grows with you

fix(desktop): the fish-shell uname probe spawns the injected sshBinary

Brooklyn Nicholson7583a6610ef7
diff --git a/apps/desktop/electron/ssh-connection.test.ts b/apps/desktop/electron/ssh-connection.test.ts
index b5981ccb287..9ccec9b66ef 100644
--- a/apps/desktop/electron/ssh-connection.test.ts
+++ b/apps/desktop/electron/ssh-connection.test.ts
@@ -1456,13 +1456,14 @@ test('withRemoteTimeout kills a hung probe remotely instead of orphaning it (#11
])
assert.equal(grandStrays.trim(), '', 'watchdog killed the launcher’s grandchild too')
- } }
-)
+ }
+})
test('exec wraps POSIX payloads in sh -c so a fish login shell never parses them', async () => {
const spawnFn = scriptedSpawn((args: any) =>
args.at(-1) === 'uname -s' ? { code: 0, stdout: 'Linux\n' } : { code: 0, stdout: 'OK\n' }
)
+
const conn = new SshConnection({ host: 'box', user: 'me' }, { spawnFn, controlDir: '/tmp/d' })
await conn.exec('help="$(true)"; echo "${X:-y}"')
const cmd = spawnFn.calls[1].at(-1)
@@ -1474,6 +1475,7 @@ test('exec leaves Windows PowerShell payloads unwrapped', async () => {
const spawnFn = scriptedSpawn((args: any) =>
args.at(-1) === 'uname -s' ? { code: 1, stderr: 'uname: command not found' } : { code: 0 }
)
+
const conn = new SshConnection({ host: 'box', user: 'me' }, { spawnFn, controlDir: '/tmp/d' })
await conn.exec('powershell.exe -NoProfile -Command "echo hi"')
assert.equal(spawnFn.calls[1].at(-1), 'powershell.exe -NoProfile -Command "echo hi"')
diff --git a/apps/desktop/electron/ssh-connection.ts b/apps/desktop/electron/ssh-connection.ts
index 952643c9af5..f758908f576 100644
--- a/apps/desktop/electron/ssh-connection.ts
+++ b/apps/desktop/electron/ssh-connection.ts
@@ -1023,7 +1023,8 @@ class SshConnection {
try {
const probe: any = await runSsh(buildExecArgs(this, 'uname -s', this._connectTimeoutMs), {
timeoutMs: timeoutMs ?? this._execTimeoutMs,
- spawnFn: this._spawnFn
+ spawnFn: this._spawnFn,
+ command: this.sshBinary
})
if (probe.code !== 255) {