From 7eb14f07697a2fa94e31607a4403038c3c3ca34f Mon Sep 17 00:00:00 2001 From: Kien La Date: Sat, 14 Sep 2024 21:10:22 -0400 Subject: [PATCH] show warning if ssh auth sock not found --- src/host_services.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/host_services.ts b/src/host_services.ts index e654672..3d9cf7b 100644 --- a/src/host_services.ts +++ b/src/host_services.ts @@ -1,4 +1,5 @@ import { existsSync, linkSync, unlinkSync } from 'fs' +import icons from './icons' import path from 'path' export function linkSshAuthSock() { @@ -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`) }