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:
@ -1,6 +1,6 @@
|
||||
import { field, logger } from "@coder/logger";
|
||||
import { ServerMessage, SharedProcessActive } from "@coder/protocol/src/proto";
|
||||
import { preserveEnv } from "@coder/protocol";
|
||||
import { withEnv } from "@coder/protocol";
|
||||
import { ChildProcess, fork, ForkOptions } from "child_process";
|
||||
import { randomFillSync } from "crypto";
|
||||
import * as fs from "fs";
|
||||
@ -175,21 +175,12 @@ const bold = (text: string | number): string | number => {
|
||||
}
|
||||
|
||||
if (options.installExtension) {
|
||||
|
||||
let forkOptions = {
|
||||
env: {
|
||||
VSCODE_ALLOW_IO: "true"
|
||||
}
|
||||
}
|
||||
|
||||
preserveEnv(forkOptions);
|
||||
|
||||
const fork = forkModule("vs/code/node/cli", [
|
||||
"--user-data-dir", dataDir,
|
||||
"--builtin-extensions-dir", builtInExtensionsDir,
|
||||
"--extensions-dir", extensionsDir,
|
||||
"--install-extension", options.installExtension,
|
||||
], forkOptions, dataDir);
|
||||
], withEnv({ env: { VSCODE_ALLOW_IO: "true" } }), dataDir);
|
||||
|
||||
fork.stdout.on("data", (d: Buffer) => d.toString().split("\n").forEach((l) => logger.info(l)));
|
||||
fork.stderr.on("data", (d: Buffer) => d.toString().split("\n").forEach((l) => logger.error(l)));
|
||||
|
@ -7,7 +7,7 @@ import { ParsedArgs } from "vs/platform/environment/common/environment";
|
||||
import { Emitter } from "@coder/events/src";
|
||||
import { retry } from "@coder/ide/src/retry";
|
||||
import { logger, field, Level } from "@coder/logger";
|
||||
import { preserveEnv } from "@coder/protocol";
|
||||
import { withEnv } from "@coder/protocol";
|
||||
|
||||
export enum SharedProcessState {
|
||||
Stopped,
|
||||
@ -89,15 +89,10 @@ export class SharedProcess {
|
||||
this.activeProcess.kill();
|
||||
}
|
||||
|
||||
let forkOptions = {
|
||||
env: {
|
||||
VSCODE_ALLOW_IO: "true"
|
||||
}
|
||||
}
|
||||
|
||||
preserveEnv(forkOptions);
|
||||
|
||||
const activeProcess = forkModule("vs/code/electron-browser/sharedProcess/sharedProcessMain", [], forkOptions, this.userDataDir);
|
||||
const activeProcess = forkModule(
|
||||
"vs/code/electron-browser/sharedProcess/sharedProcessMain", [],
|
||||
withEnv({ env: { VSCODE_ALLOW_IO: "true" } }), this.userDataDir,
|
||||
);
|
||||
this.activeProcess = activeProcess;
|
||||
|
||||
await new Promise((resolve, reject): void => {
|
||||
|
Reference in New Issue
Block a user