|
1 | 1 | import * as cp from "child_process";
|
2 | 2 | import { ServerProxy } from "../../common/proxy";
|
3 |
| -import { preserveEnv } from "../../common/util"; |
| 3 | +import { withEnv } from "../../common/util"; |
4 | 4 | import { WritableProxy, ReadableProxy } from "./stream";
|
5 | 5 |
|
6 | 6 | // tslint:disable completed-docs
|
@@ -71,21 +71,15 @@ export class ChildProcessModuleProxy {
|
71 | 71 | options?: { encoding?: string | null } & cp.ExecOptions | null,
|
72 | 72 | callback?: ((error: cp.ExecException | null, stdin: string | Buffer, stdout: string | Buffer) => void),
|
73 | 73 | ): Promise<ChildProcessProxies> {
|
74 |
| - preserveEnv(options); |
75 |
| - |
76 |
| - return this.returnProxies(cp.exec(command, options, callback)); |
| 74 | + return this.returnProxies(cp.exec(command, options && withEnv(options), callback)); |
77 | 75 | }
|
78 | 76 |
|
79 | 77 | public async fork(modulePath: string, args?: string[], options?: cp.ForkOptions): Promise<ChildProcessProxies> {
|
80 |
| - preserveEnv(options); |
81 |
| - |
82 |
| - return this.returnProxies((this.forkProvider || cp.fork)(modulePath, args, options)); |
| 78 | + return this.returnProxies((this.forkProvider || cp.fork)(modulePath, args, withEnv(options))); |
83 | 79 | }
|
84 | 80 |
|
85 | 81 | public async spawn(command: string, args?: string[], options?: cp.SpawnOptions): Promise<ChildProcessProxies> {
|
86 |
| - preserveEnv(options); |
87 |
| - |
88 |
| - return this.returnProxies(cp.spawn(command, args, options)); |
| 82 | + return this.returnProxies(cp.spawn(command, args, withEnv(options))); |
89 | 83 | }
|
90 | 84 |
|
91 | 85 | private returnProxies(process: cp.ChildProcess): ChildProcessProxies {
|
|
0 commit comments