From 6f39fd026e1833479ae7f9fb625486b59e534113 Mon Sep 17 00:00:00 2001 From: Luca Milanesio Date: Wed, 25 Feb 2015 15:43:54 +0000 Subject: [PATCH 1/4] Added extra logs when child PIDs start/end --- app.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app.js b/app.js index 3023a5f..87732fe 100644 --- a/app.js +++ b/app.js @@ -8,7 +8,9 @@ var fs = require('fs'); var waitpid = require('waitpid'); process.on('SIGCHLD', function(args){ + console.error((new Date()) + " Got SIGCHLD: waiting for child process to terminate ... ") waitpid(-1); + console.error((new Date()) + " Child processed ended") }); var opts = require('optimist') @@ -129,11 +131,15 @@ wss.on('request', function(request) { rows: 30 }); } + console.log((new Date()) + " PID=" + term.pid + " STARTED on behalf of user=" + sshuser) term.on('data', function(data) { conn.send(JSON.stringify({ data: data })); }); + term.on('exit', function(code) { + console.log((new Date()) + " PID=" + term.pid + " ENDED") + }) } if (!data) return; From 163a7ed6cacfb7e7f8687776ad8ca6e3c10fc1d1 Mon Sep 17 00:00:00 2001 From: Luca Milanesio Date: Wed, 25 Feb 2015 15:51:39 +0000 Subject: [PATCH 2/4] use pty.js that merges in niallo:waitpid fixes as in terryschen:wetty --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3e997ec..7ae305d 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "dependencies": { "express": "3.5.1", "websocket": "", - "pty.js": "", + "pty.js": "git+https://github.com/terryschen/pty.js", "optimist": "", "waitpid": "" }, From 56f64491733ed86b27828788fa8d7cf41d05e076 Mon Sep 17 00:00:00 2001 From: Luca Milanesio Date: Wed, 25 Feb 2015 16:16:40 +0000 Subject: [PATCH 3/4] Thanks to the niallo:waitpid fixes, the SIGCHLD is automatically managed --- app.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app.js b/app.js index 87732fe..141306d 100644 --- a/app.js +++ b/app.js @@ -7,12 +7,6 @@ var pty = require('pty.js'); var fs = require('fs'); var waitpid = require('waitpid'); -process.on('SIGCHLD', function(args){ - console.error((new Date()) + " Got SIGCHLD: waiting for child process to terminate ... ") - waitpid(-1); - console.error((new Date()) + " Child processed ended") -}); - var opts = require('optimist') .options({ sslkey: { From b3d4b4c7f5a256d43acc59217af57cd788070d4a Mon Sep 17 00:00:00 2001 From: Luca Milanesio Date: Wed, 25 Feb 2015 16:18:34 +0000 Subject: [PATCH 4/4] Using a more politically correct page title (was WTF) --- public/index.html | 2 +- public/wetty/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/index.html b/public/index.html index a71d745..00281a9 100644 --- a/public/index.html +++ b/public/index.html @@ -3,7 +3,7 @@ - wtf + Wetty - The WebTTY Terminal Emulator diff --git a/public/wetty/index.html b/public/wetty/index.html index a71d745..00281a9 100644 --- a/public/wetty/index.html +++ b/public/wetty/index.html @@ -3,7 +3,7 @@ - wtf + Wetty - The WebTTY Terminal Emulator