From 33e7aaddc4a1d7b02339df25ab33b4e078821e42 Mon Sep 17 00:00:00 2001 From: Karoun Kasraie Date: Mon, 2 Dec 2024 18:14:56 -0800 Subject: [PATCH 1/4] Supporting env object in debugger task --- src/debugger.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/debugger.ts b/src/debugger.ts index 378e211..c3cecda 100644 --- a/src/debugger.ts +++ b/src/debugger.ts @@ -49,6 +49,7 @@ interface HhvmLaunchRequestArguments remoteType?: string; remoteWorkspacePath?: string; dockerContainerName?: string; + env?: Record; } class HHVMDebuggerWrapper { @@ -258,7 +259,7 @@ class HHVMDebuggerWrapper { : ["pipe", "pipe", "pipe", "pipe"], // When the wrapper exits, so does the target. detached: false, - env: process.env, + env: { ...process.env, ...(args.env ?? {}) } }; const targetProcess = child_process.spawn(hhvmPath, allArgs, options); @@ -334,6 +335,7 @@ class HHVMDebuggerWrapper { kind: "integrated", cwd: __dirname, args: terminalArgs, + env: { ...process.env, ...(args.env ?? {}) } }; this.writeOutputWithHeader({ From 1e2c995b09ca65b885236ab845cd12af8ad5ca4a Mon Sep 17 00:00:00 2001 From: Karoun Kasraie Date: Mon, 2 Dec 2024 18:20:47 -0800 Subject: [PATCH 2/4] Adding debugger task env to JSON schema --- package.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/package.json b/package.json index baa9276..6a13b86 100644 --- a/package.json +++ b/package.json @@ -156,6 +156,13 @@ "type": "string", "description": "Working directory for the launched HHVM process", "default": "${workspaceFolder}" + }, + "env": { + "type": "object", + "description": "Extra environment variables for the HHVM command", + "additionalProperties": { + "type": "string" + }, } } } From 15fa4df2345f4e5c7710879ecd8c746141a30f42 Mon Sep 17 00:00:00 2001 From: Karoun Kasraie Date: Mon, 2 Dec 2024 18:21:46 -0800 Subject: [PATCH 3/4] Update debugging docs --- docs/debugging.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/debugging.md b/docs/debugging.md index e2cc3bc..a66e6f8 100644 --- a/docs/debugging.md +++ b/docs/debugging.md @@ -10,6 +10,7 @@ Add a new HHVM `launch` config to `.vscode/launch.json`. The default template sh `hhvmPath`: [Optional] Absolute path to the HHVM executable (default `hhvm`) `hhvmArgs`: [Optional] Extra arguments to pass to HHVM when launching the script, if needed `cwd`: [Optional] Working directory for the HHVM process +`env`: [Optional] Extra environment variables for the HHVM process Debug -> Start Debugging (F5) with this configuration selected will launch the currently open PHP/Hack script (or the custom configured file) in a new HHVM process and pipe input/output to the editor OUTPUT tab. From ffaf250769f10f8a7bfc2d006580334e9a6f4613 Mon Sep 17 00:00:00 2001 From: Karoun Kasraie Date: Mon, 2 Dec 2024 18:22:21 -0800 Subject: [PATCH 4/4] Fixing newline? --- docs/debugging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/debugging.md b/docs/debugging.md index a66e6f8..30688cc 100644 --- a/docs/debugging.md +++ b/docs/debugging.md @@ -9,7 +9,7 @@ Add a new HHVM `launch` config to `.vscode/launch.json`. The default template sh `script`: The PHP/Hack script to launch. Use `${file}` to run the currently open file in the editor, or set to any other static file path. `hhvmPath`: [Optional] Absolute path to the HHVM executable (default `hhvm`) `hhvmArgs`: [Optional] Extra arguments to pass to HHVM when launching the script, if needed -`cwd`: [Optional] Working directory for the HHVM process +`cwd`: [Optional] Working directory for the HHVM process `env`: [Optional] Extra environment variables for the HHVM process Debug -> Start Debugging (F5) with this configuration selected will launch the currently open PHP/Hack script (or the custom configured file) in a new HHVM process and pipe input/output to the editor OUTPUT tab.