diff --git a/cmd/tsconnect/src/app/ssh.tsx b/cmd/tsconnect/src/app/ssh.tsx index bd8ee4690..8048d9b2a 100644 --- a/cmd/tsconnect/src/app/ssh.tsx +++ b/cmd/tsconnect/src/app/ssh.tsx @@ -46,7 +46,7 @@ function SSHSession({ const ref = useRef(null) useEffect(() => { if (ref.current) { - runSSHSession(ref.current, def, ipn, onDone) + runSSHSession(ref.current, def, ipn, onDone, (err) => console.error(err)) } }, [ref]) diff --git a/cmd/tsconnect/src/lib/ssh.ts b/cmd/tsconnect/src/lib/ssh.ts index f489bb5b2..8712f2a27 100644 --- a/cmd/tsconnect/src/lib/ssh.ts +++ b/cmd/tsconnect/src/lib/ssh.ts @@ -14,6 +14,7 @@ export function runSSHSession( def: SSHSessionDef, ipn: IPN, onDone: () => void, + onError?: (err: string) => void, terminalOptions?: ITerminalOptions ) { const parentWindow = termContainerNode.ownerDocument.defaultView ?? window @@ -48,7 +49,7 @@ export function runSSHSession( term.write(input) }, writeErrorFn(err) { - console.error(err) + onError?.(err) term.write(err) }, setReadFn(hook) {