Skip to content

Commit

Permalink
fix: run:inside hangs (doesn't error) when no/invalid SSH key (#3130)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinwilaby authored Dec 6, 2024
1 parent 91b48f2 commit b44fcf8
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions packages/cli/src/lib/run/dyno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,28 @@ export default class Dyno extends Duplex {
sshProc.stdout.on('data', this._readData())
}

// @ts-ignore
sshProc.stderr.on('data', data => {
lastErr = data
sshProc.stderr?.on('data', data => {
lastErr = data.toString()

// suppress host key and permission denied messages
if (this._isDebug() || (data.includes("Warning: Permanently added '[127.0.0.1]") && data.includes('Permission denied (publickey).'))) {
const messages = [
"Warning: Permanently added '[127.0.0.1]"
]

const killMessages = [
'too many authentication failures',
'No more authentication methods to try',
'Permission denied (publickey).',
]
if (this._isDebug() || [...killMessages, ...messages].some(message => data.includes(message))) {
process.stderr.write(data)
}

if (killMessages.some(message => data.includes(message))) {
sshProc.kill()
localServer.close()
this.reject?.(lastErr)
}
})
sshProc.on('close', () => {
// there was a problem connecting with the ssh key
Expand Down

0 comments on commit b44fcf8

Please sign in to comment.