Skip to content

Commit

Permalink
update ssh check
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielhicks committed Dec 12, 2024
1 parent 61f996a commit f07a7c4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion packages/solv/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# @gabrielhicks/solv

## 4.8.10

### Patch Changes
Switch user option 3

## 4.8.9

### Patch Changes
Switch user option
Switch user option 2

## 4.8.8

Expand Down
4 changes: 2 additions & 2 deletions packages/solv/src/cli/scp/checkSSHConnection.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { spawnSync } from 'node:child_process'

export function checkSSHConnection(ip: string) {
const cmd = `ssh -o BatchMode=yes -o ConnectTimeout=5 solv@${ip} exit`
export function checkSSHConnection(ip: string, user: string) {
const cmd = `ssh -o BatchMode=yes -o ConnectTimeout=5 ${user}@${ip} exit`
const result = spawnSync(cmd, { shell: true, stdio: 'inherit' })

return result.status === 0
Expand Down
2 changes: 1 addition & 1 deletion packages/solv/src/cli/switch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const switchCommand = async (
return
}

const result = checkSSHConnection(ip)
const result = checkSSHConnection(ip, user)
if (!result) {
console.log('SSH Connection Failed')
return
Expand Down

0 comments on commit f07a7c4

Please sign in to comment.