webtty.js: set up the environment and working directory.
This commit is contained in:
parent
508b41b488
commit
5d2a367e1d
1 changed files with 11 additions and 1 deletions
12
webtty.js
12
webtty.js
|
|
@ -7,14 +7,24 @@ var fs = require('fs');
|
||||||
var child_process = require("child_process");
|
var child_process = require("child_process");
|
||||||
|
|
||||||
var serveStaticRoot = "/home/elwin/hk/nodejs/rlg/s/";
|
var serveStaticRoot = "/home/elwin/hk/nodejs/rlg/s/";
|
||||||
|
var ptyhelp = "/home/elwin/hk/nodejs/rlg/ptywreck/ptyhelperC";
|
||||||
var sessions = {};
|
var sessions = {};
|
||||||
|
|
||||||
|
var env_dontuse = {"TMUX": true, "TMUX_PANE": true};
|
||||||
|
|
||||||
/* Constructor for TermSessions. Note that it opens the terminal and
|
/* Constructor for TermSessions. Note that it opens the terminal and
|
||||||
* adds itself to the sessions dict.
|
* adds itself to the sessions dict.
|
||||||
*/
|
*/
|
||||||
function TermSession(sessid) {
|
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");
|
//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;
|
var ss = this;
|
||||||
/* Eventually we'll need to make sure the sessid isn't in use yet. */
|
/* Eventually we'll need to make sure the sessid isn't in use yet. */
|
||||||
this.sessid = sessid;
|
this.sessid = sessid;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue