chore: update debug messages

This commit is contained in:
Bill Church 2024-10-14 19:33:50 +00:00
parent 8d515f6a77
commit 6ff58c55f5
No known key found for this signature in database
2 changed files with 19 additions and 2 deletions

View file

@ -191,11 +191,20 @@ class WebSSH2Socket extends EventEmitter {
stream.on("data", data => {
this.socket.emit("data", data.toString("utf-8"))
})
stream.stderr.on("data", data => debug(`STDERR: ${data}`))
// stream.stderr.on("data", data => debug(`STDERR: ${data}`)) // needed for shell.exec
stream.on("close", (code, signal) => {
debug("close: SSH Stream closed")
this.handleConnectionClose(code, signal)
})
stream.on("end", () => {
debug("end: SSH Stream ended")
})
stream.on("error", (err) => {
debug("error: SSH Stream error %O", err)
})
this.socket.on("data", data => {
stream.write(data)
})
@ -206,7 +215,7 @@ class WebSSH2Socket extends EventEmitter {
this.handleResize(data)
})
})
.catch(err => this.handleError("SHELL ERROR", err))
.catch(err => this.handleError("createShell: ERROR", err))
}
handleResize(data) {

View file

@ -48,6 +48,14 @@ class SSHConnection extends EventEmitter {
resolve(this.conn)
})
this.conn.on("end", () => {
debug(`connect: end: `)
})
this.conn.on("close", () => {
debug(`connect: close: `)
})
this.conn.on("error", err => {
const error = new SSHConnectionError(`${err.message}`)
handleError(error)