From 71c9743e388999a5ffe5997fe259a2af3283dad3 Mon Sep 17 00:00:00 2001 From: Mofei Zhang Date: Fri, 26 May 2023 13:18:37 -0400 Subject: [PATCH] [snap] Fix vscode debugger attaching to forked proc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Turns out I just forgot to forward `process.env` when forking 😅 `debugger` statements and breakpoints should work with both `--sync` and `--no-sync` (default) modes --- compiler/forget/packages/snap/src/main.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/forget/packages/snap/src/main.ts b/compiler/forget/packages/snap/src/main.ts index 9f3410dd2d..6ee3f7a806 100644 --- a/compiler/forget/packages/snap/src/main.ts +++ b/compiler/forget/packages/snap/src/main.ts @@ -34,7 +34,9 @@ const childProc = fork(require.resolve("./runner.js"), hideBin(process.argv), { // when we `inherit` stdin. // pipe stdout and stderr so we can silence child process after parent exits stdio: ["pipe", "pipe", "pipe", "ipc"], - env: { FORCE_COLOR: "true" }, + // forward existing env variables, like `NODE_OPTIONS` which VSCode uses to attach + // its debugger + env: { ...process.env, FORCE_COLOR: "true" }, }); invariant(