Mercurial > hg > rlgwebd
comparison webtty.js @ 2:98bf7c94c954
webtty.js: set up the environment and working directory.
author | John "Elwin" Edwards <elwin@sdf.org> |
---|---|
date | Sun, 06 May 2012 15:06:32 -0700 |
parents | bd412f63ce0d |
children | bfdc775a574f |
comparison
equal
deleted
inserted
replaced
1:9bef0941c6dd | 2:98bf7c94c954 |
---|---|
5 var fs = require('fs'); | 5 var fs = require('fs'); |
6 //var tty = require("tty"); | 6 //var tty = require("tty"); |
7 var child_process = require("child_process"); | 7 var child_process = require("child_process"); |
8 | 8 |
9 var serveStaticRoot = "/home/elwin/hk/nodejs/rlg/s/"; | 9 var serveStaticRoot = "/home/elwin/hk/nodejs/rlg/s/"; |
10 var ptyhelp = "/home/elwin/hk/nodejs/rlg/ptywreck/ptyhelperC"; | |
10 var sessions = {}; | 11 var sessions = {}; |
12 | |
13 var env_dontuse = {"TMUX": true, "TMUX_PANE": true}; | |
11 | 14 |
12 /* Constructor for TermSessions. Note that it opens the terminal and | 15 /* Constructor for TermSessions. Note that it opens the terminal and |
13 * adds itself to the sessions dict. | 16 * adds itself to the sessions dict. |
14 */ | 17 */ |
15 function TermSession(sessid) { | 18 function TermSession(sessid) { |
19 var childenv = {}; | |
20 for (var key in process.env) { | |
21 if (!(key in env_dontuse)) | |
22 childenv[key] = process.env[key]; | |
23 } | |
24 // Should setsid get set? | |
25 var spawnopts = {"env": childenv, "cwd": process.env["HOME"]}; | |
16 //var pterm = tty.open("/bin/bash"); | 26 //var pterm = tty.open("/bin/bash"); |
17 this.child = child_process.spawn("./ptywreck/ptyhelperC", ["bash"]); | 27 this.child = child_process.spawn(ptyhelp, ["bash"], spawnopts); |
18 var ss = this; | 28 var ss = this; |
19 /* Eventually we'll need to make sure the sessid isn't in use yet. */ | 29 /* Eventually we'll need to make sure the sessid isn't in use yet. */ |
20 this.sessid = sessid; | 30 this.sessid = sessid; |
21 //this.ptmx = pterm[0]; | 31 //this.ptmx = pterm[0]; |
22 //this.child = pterm[1]; | 32 //this.child = pterm[1]; |