Process environment extends original one now #98
This commit is contained in:
parent
464e2301c6
commit
907fbd5004
1 changed files with 21 additions and 1 deletions
|
|
@ -27,8 +27,27 @@ function couldBeOutput(line: string) {
|
||||||
const trace = false;
|
const trace = false;
|
||||||
|
|
||||||
export class MI2 extends EventEmitter implements IBackend {
|
export class MI2 extends EventEmitter implements IBackend {
|
||||||
constructor(public application: string, public preargs: string[], public extraargs: string[], public procEnv: any) {
|
constructor(public application: string, public preargs: string[], public extraargs: string[], procEnv: any) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
if (procEnv) {
|
||||||
|
var env = {};
|
||||||
|
// Duplicate process.env so we don't override it
|
||||||
|
for (var key in process.env)
|
||||||
|
if (process.env.hasOwnProperty(key))
|
||||||
|
env[key] = process.env[key];
|
||||||
|
|
||||||
|
// Overwrite with user specified variables
|
||||||
|
for (var key in procEnv) {
|
||||||
|
if (procEnv.hasOwnProperty(key)) {
|
||||||
|
if (procEnv === null)
|
||||||
|
delete env[key];
|
||||||
|
else
|
||||||
|
env[key] = procEnv[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.procEnv = env;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
load(cwd: string, target: string, procArgs: string, separateConsole: string): Thenable<any> {
|
load(cwd: string, target: string, procArgs: string, separateConsole: string): Thenable<any> {
|
||||||
|
|
@ -693,6 +712,7 @@ export class MI2 extends EventEmitter implements IBackend {
|
||||||
|
|
||||||
printCalls: boolean;
|
printCalls: boolean;
|
||||||
debugOutput: boolean;
|
debugOutput: boolean;
|
||||||
|
public procEnv: any;
|
||||||
protected isSSH: boolean;
|
protected isSSH: boolean;
|
||||||
protected sshReady: boolean;
|
protected sshReady: boolean;
|
||||||
protected currentToken: number = 1;
|
protected currentToken: number = 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue