Mercurial > hg > rlgwebd
comparison rlgwebd.js @ 84:d59dc5cef412
rlgwebd.js: set the width and height on Player objects.
Fixes the client not being informed of the pty size.
| author | John "Elwin" Edwards <elwin@sdf.org> |
|---|---|
| date | Sun, 08 Jul 2012 08:40:08 -0700 |
| parents | e4773ac5d4d5 |
| children | 4303d94d87a2 |
comparison
equal
deleted
inserted
replaced
| 83:e04c8bf6d4da | 84:d59dc5cef412 |
|---|---|
| 110 childenv[key] = process.env[key]; | 110 childenv[key] = process.env[key]; |
| 111 } | 111 } |
| 112 childenv["PTYHELPER"] = String(this.h) + "x" + String(this.w); | 112 childenv["PTYHELPER"] = String(this.h) + "x" + String(this.w); |
| 113 args = [this.game.path, "-n", this.pname]; | 113 args = [this.game.path, "-n", this.pname]; |
| 114 this.child = child_process.spawn("/bin/ptyhelper", args, {"env": childenv}); | 114 this.child = child_process.spawn("/bin/ptyhelper", args, {"env": childenv}); |
| 115 this.emit('open', true); | 115 this.emit('open', true, this.sessid); |
| 116 /* Set up the lockfile and ttyrec */ | 116 /* Set up the lockfile and ttyrec */ |
| 117 var ts = timestamp(); | 117 var ts = timestamp(); |
| 118 var progressdir = "/dgldir/inprogress-" + this.game.uname; | 118 var progressdir = "/dgldir/inprogress-" + this.game.uname; |
| 119 this.lock = path.join(progressdir, this.pname + ":node:" + ts + ".ttyrec"); | 119 this.lock = path.join(progressdir, this.pname + ":node:" + ts + ".ttyrec"); |
| 120 var lmsg = this.child.pid.toString() + '\n' + this.w + '\n' + this.h + '\n'; | 120 var lmsg = this.child.pid.toString() + '\n' + this.w + '\n' + this.h + '\n'; |
| 309 }; | 309 }; |
| 310 this.quit = function() { | 310 this.quit = function() { |
| 311 if (this.alive) | 311 if (this.alive) |
| 312 this.session.close(); | 312 this.session.close(); |
| 313 }; | 313 }; |
| 314 function openH(success) { | 314 function openH(success, id) { |
| 315 if (success) { | 315 if (success) { |
| 316 ss.alive = true; | 316 ss.alive = true; |
| 317 ss.session = sessions[id]; | |
| 318 ss.h = sessions[id].h; | |
| 319 ss.w = sessions[id].w; | |
| 317 } | 320 } |
| 318 callback(ss, success); | 321 callback(ss, success); |
| 319 } | 322 } |
| 320 function dataH(chunk) { | 323 function dataH(chunk) { |
| 321 var reply = {}; | 324 var reply = {}; |
