[snap] Fix vscode debugger attaching to forked proc
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
Mofei Zhang committed
May 26, 2023 at 13:18 UTC
71c9743e388999a5ffe5997fe259a2af3283dad3
1 file changed
+3
-1
compiler/forget/packages/snap/src/main.ts
+3
-1
@@ -34,7 +34,9 @@ const childProc = fork(require.resolve("./runner.js"), hideBin(process.argv), {
34
// when we `inherit` stdin.
35
// pipe stdout and stderr so we can silence child process after parent exits
36
stdio: ["pipe", "pipe", "pipe", "ipc"],
37
- env: { FORCE_COLOR: "true" },
37
+ // forward existing env variables, like `NODE_OPTIONS` which VSCode uses to attach
38
+ // its debugger
39
+ env: { ...process.env, FORCE_COLOR: "true" },
40
});
41
42
invariant(