Skip to content

Commit

Permalink
show warning if ssh auth sock not found
Browse files Browse the repository at this point in the history
  • Loading branch information
kla committed Sep 15, 2024
1 parent 4cf345b commit 7eb14f0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/host_services.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { existsSync, linkSync, unlinkSync } from 'fs'
import icons from './icons'
import path from 'path'

export function linkSshAuthSock() {
Expand All @@ -7,6 +8,11 @@ export function linkSshAuthSock() {

const targetPath = path.join(process.env.STAX_HOST_SERVICES, 'ssh-auth.sock')

if (existsSync(targetPath)) unlinkSync(targetPath)
linkSync(process.env.SSH_AUTH_SOCK, targetPath)
if (existsSync(targetPath))
unlinkSync(targetPath)

if (existsSync(process.env.SSH_AUTH_SOCK))
linkSync(process.env.SSH_AUTH_SOCK, targetPath)
else
console.warn(`${icons.warning} Couldn't create ${targetPath} because SSH_AUTH_SOCK (${process.env.SSH_AUTH_SOCK}) not found`)
}

0 comments on commit 7eb14f0

Please sign in to comment.