Extension host (#20)
* Implement net.Server * Move Socket class into Client This way we don't need to expose anything. * Remove some unused imports * Pass environment variables to bootstrap fork * Add debug log for when socket disconnects from server * Use VSCODE_ALLOW_IO for shared process only * Extension host can send messages now * Support callback for logging This lets us do potentially expensive operations which will only be performed if the log level is sufficiently low. * Stop extension host from committing suicide * Blank line * Add static serve (#21) * Add extension URLs * how did i remove this * Fix writing an empty string * Implement dialogs on window service
This commit is contained in:
@ -5,7 +5,9 @@ import * as path from "path";
|
||||
|
||||
export const requireModule = (modulePath: string): void => {
|
||||
process.env.AMD_ENTRYPOINT = modulePath;
|
||||
process.env.VSCODE_ALLOW_IO = "true";
|
||||
|
||||
// Always do this so we can see console.logs.
|
||||
// process.env.VSCODE_ALLOW_IO = "true";
|
||||
|
||||
if (!process.send) {
|
||||
const socket = new net.Socket({ fd: 3 });
|
||||
@ -31,10 +33,13 @@ export const requireModule = (modulePath: string): void => {
|
||||
* cp.stderr.on("data", (data) => console.log(data.toString("utf8")));
|
||||
* @param modulePath Path of the VS Code module to load.
|
||||
*/
|
||||
export const forkModule = (modulePath: string): cp.ChildProcess => {
|
||||
export const forkModule = (modulePath: string, env?: NodeJS.ProcessEnv): cp.ChildProcess => {
|
||||
let proc: cp.ChildProcess | undefined;
|
||||
|
||||
const args = ["--bootstrap-fork", modulePath];
|
||||
if (env) {
|
||||
args.push("--env", JSON.stringify(env));
|
||||
}
|
||||
const options: cp.SpawnOptions = {
|
||||
stdio: [null, null, null, "pipe"],
|
||||
};
|
||||
|
@ -66,7 +66,9 @@ export class SharedProcess {
|
||||
state: SharedProcessState.Starting,
|
||||
});
|
||||
let resolved: boolean = false;
|
||||
this.activeProcess = forkModule("vs/code/electron-browser/sharedProcess/sharedProcessMain", true);
|
||||
this.activeProcess = forkModule("vs/code/electron-browser/sharedProcess/sharedProcessMain", {
|
||||
VSCODE_ALLOW_IO: "true",
|
||||
});
|
||||
this.activeProcess.on("exit", (err) => {
|
||||
if (this._state !== SharedProcessState.Stopped) {
|
||||
this.setState({
|
||||
|
Reference in New Issue
Block a user