Make preserveEnv return a new object

Modifying the object didn't feel quite right, plus this makes the code a
bit more compact.
This commit is contained in:
Asher
2019-04-29 11:49:59 -05:00
parent 1622fd4152
commit cdb900aca8
5 changed files with 20 additions and 39 deletions

View File

@@ -2,7 +2,7 @@
import { EventEmitter } from "events";
import * as pty from "node-pty";
import { ServerProxy } from "../../common/proxy";
import { preserveEnv } from "../../common/util";
import { withEnv } from "../../common/util";
// tslint:disable completed-docs
@@ -66,8 +66,6 @@ export class NodePtyProcessProxy extends ServerProxy {
*/
export class NodePtyModuleProxy {
public async spawn(file: string, args: string[] | string, options: pty.IPtyForkOptions): Promise<NodePtyProcessProxy> {
preserveEnv(options);
return new NodePtyProcessProxy(require("node-pty").spawn(file, args, options));
return new NodePtyProcessProxy(require("node-pty").spawn(file, args, withEnv(options)));
}
}