MCPcopy
hub / github.com/claude-code-best/claude-code / runSshCommand

Function runSshCommand

src/ssh/SSHDeploy.ts:18–40  ·  view source on GitHub ↗
(
  host: string,
  command: string,
  timeoutMs = SSH_TIMEOUT_MS,
)

Source from the content-addressed store, hash-verified

16}
17
18async function runSshCommand(
19 host: string,
20 command: string,
21 timeoutMs = SSH_TIMEOUT_MS,
22): Promise<{ stdout: string; stderr: string; exitCode: number }> {
23 const proc = Bun.spawn(['ssh', '-o', 'ConnectTimeout=10', host, command], {
24 stdout: 'pipe',
25 stderr: 'pipe',
26 })
27
28 const timer = setTimeout(() => proc.kill(), timeoutMs)
29
30 try {
31 const [stdout, stderr] = await Promise.all([
32 new Response(proc.stdout).text(),
33 new Response(proc.stderr).text(),
34 ])
35 const exitCode = await proc.exited
36 return { stdout: stdout.trim(), stderr: stderr.trim(), exitCode }
37 } finally {
38 clearTimeout(timer)
39 }
40}
41
42function findLocalBinary(): string {
43 const projectRoot = resolve(import.meta.dir, '../..')

Callers 1

deployBinaryFunction · 0.85

Calls 3

textMethod · 0.80
spawnMethod · 0.45
killMethod · 0.45

Tested by

no test coverage detected