Browse Source

Merge pull request #13 from lucamilanesio/master

Stabilise Wetty with regards to child process exits
pull/31/head
Krishna Srinivas 10 years ago
parent
commit
7d928db43c
  1. 8
      app.js
  2. 2
      package.json
  3. 2
      public/index.html
  4. 2
      public/wetty/index.html

8
app.js

@ -7,10 +7,6 @@ var pty = require('pty.js');
var fs = require('fs'); var fs = require('fs');
var waitpid = require('waitpid'); var waitpid = require('waitpid');
process.on('SIGCHLD', function(args){
waitpid(-1);
});
var opts = require('optimist') var opts = require('optimist')
.options({ .options({
sslkey: { sslkey: {
@ -129,11 +125,15 @@ wss.on('request', function(request) {
rows: 30 rows: 30
}); });
} }
console.log((new Date()) + " PID=" + term.pid + " STARTED on behalf of user=" + sshuser)
term.on('data', function(data) { term.on('data', function(data) {
conn.send(JSON.stringify({ conn.send(JSON.stringify({
data: data data: data
})); }));
}); });
term.on('exit', function(code) {
console.log((new Date()) + " PID=" + term.pid + " ENDED")
})
} }
if (!data) if (!data)
return; return;

2
package.json

@ -4,7 +4,7 @@
"dependencies": { "dependencies": {
"express": "3.5.1", "express": "3.5.1",
"websocket": "", "websocket": "",
"pty.js": "", "pty.js": "git+https://github.com/terryschen/pty.js",
"optimist": "", "optimist": "",
"waitpid": "" "waitpid": ""
}, },

2
public/index.html

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>wtf</title> <title>Wetty - The WebTTY Terminal Emulator</title>
<script src="/wetty/hterm_all.js"></script> <script src="/wetty/hterm_all.js"></script>
<script src="/wetty/hterm.js"></script> <script src="/wetty/hterm.js"></script>
<script src="/wetty/wetty.js"></script> <script src="/wetty/wetty.js"></script>

2
public/wetty/index.html

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>wtf</title> <title>Wetty - The WebTTY Terminal Emulator</title>
<script src="/wetty/hterm_all.js"></script> <script src="/wetty/hterm_all.js"></script>
<script src="/wetty/hterm.js"></script> <script src="/wetty/hterm.js"></script>
<script src="/wetty/wetty.js"></script> <script src="/wetty/wetty.js"></script>

Loading…
Cancel
Save