Repository navigation
Commit cddbcaa
committed
fix(bridge): read TNB_LIB_PATH via os.Getenv first (Windows support)
On Windows, Node's process.env write goes through SetEnvironmentVariableW,
which never touches the CRT environ block that libc getenv reads — so the
noembed lib-path override introduced for the c-shared bridge was invisible
to Go, and tsgo fell back to the executable-adjacent path (node.exe's dir)
and panicked: 'lib.d.ts does not exist; this executable may be misplaced'
(issue #9).
getenvLive now tries os.Getenv first — Go resolves it through the Win32
environment block, the one channel that sees SetEnvironmentVariableW — and
falls back to libc getenv for POSIX, where Go's runtime-init snapshot can
miss a setenv issued immediately before koffi.load. Both set-before-dlopen
channels are covered.1 parent 90f30b7 commit cddbcaa
2 files changed
Lines changed: 20 additions & 8 deletions
File tree
- patches
- typescript-go
- typescript/overlay/src/compiler
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
31 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
32 | 42 | | |
33 | 43 | | |
34 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
366 | | - | |
367 | | - | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
368 | 370 | | |
369 | 371 | | |
370 | 372 | | |
| |||
0 commit comments