webtty.js: set up the environment and working directory.

This commit is contained in:
John "Elwin" Edwards 2012-05-06 15:06:32 -07:00
parent 508b41b488
commit 5d2a367e1d

View file

@ -7,14 +7,24 @@ var fs = require('fs');
var child_process = require("child_process");
var serveStaticRoot = "/home/elwin/hk/nodejs/rlg/s/";
var ptyhelp = "/home/elwin/hk/nodejs/rlg/ptywreck/ptyhelperC";
var sessions = {};
var env_dontuse = {"TMUX": true, "TMUX_PANE": true};
/* Constructor for TermSessions. Note that it opens the terminal and
* adds itself to the sessions dict.
*/
function TermSession(sessid) {
var childenv = {};
for (var key in process.env) {
if (!(key in env_dontuse))
childenv[key] = process.env[key];
}
// Should setsid get set?
var spawnopts = {"env": childenv, "cwd": process.env["HOME"]};
//var pterm = tty.open("/bin/bash");
this.child = child_process.spawn("./ptywreck/ptyhelperC", ["bash"]);
this.child = child_process.spawn(ptyhelp, ["bash"], spawnopts);
var ss = this;
/* Eventually we'll need to make sure the sessid isn't in use yet. */
this.sessid = sessid;