From 581ef864492fcb82c83669a64d625c9624aea8aa Mon Sep 17 00:00:00 2001 From: cbutler Date: Mon, 9 Jul 2018 11:48:30 +0100 Subject: [PATCH] update pty to maintained version --- package.json | 2 +- wetty.mjs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index fa62688..2db8d2b 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "fs-extra": "^4.0.1", "optimist": "^0.6", "pre-commit": "^1.2.2", - "pty.js": "^0.3.1", + "node-pty": "^0.7.4", "serve-favicon": "^2.4.3", "socket.io": "^1.3.7" }, diff --git a/wetty.mjs b/wetty.mjs index 6635625..b5181e1 100644 --- a/wetty.mjs +++ b/wetty.mjs @@ -3,7 +3,7 @@ import http from 'http'; import https from 'https'; import path from 'path'; import server from 'socket.io'; -import pty from 'pty.js'; +import { spawn } from 'node-pty'; import EventEmitter from 'events'; import favicon from 'serve-favicon'; @@ -58,13 +58,12 @@ function getCommand(socket, sshuser, sshhost, sshport, sshauth) { } export default function start(port, sshuser, sshhost, sshport, sshauth, sslopts) { - const httpserv = createServer(port, sslopts); const events = new EventEmitter(); - const io = server(httpserv, { path: '/wetty/socket.io' }); + const io = server(createServer(port, sslopts), { path: '/wetty/socket.io' }); io.on('connection', socket => { console.log(`${new Date()} Connection accepted.`); const [args, ssh] = getCommand(socket, sshuser, sshhost, sshport, sshauth); - const term = pty.spawn('/usr/bin/env', args, { + const term = spawn('/usr/bin/env', args, { name: 'xterm-256color', cols: 80, rows: 30,