Skip to content

Commit

Permalink
chore: update debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
billchurch committed Oct 14, 2024
1 parent 8d515f6 commit 6ff58c5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
13 changes: 11 additions & 2 deletions app/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand All @@ -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) {
Expand Down
8 changes: 8 additions & 0 deletions app/ssh.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6ff58c5

Please sign in to comment.