Skip to content

Commit afef040

Browse files
TimelordUKclaude
andcommitted
fix: use node instead of echo in binding.gyp for cross-platform compatibility
The print_variables action used bare 'echo' which fails on Windows when Git Bash is not in PATH, as echo is a cmd.exe built-in not a standalone executable. Replace with 'node -p' which is guaranteed available and works on all platforms without OS-conditional logic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 678eb09 commit afef040

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

binding.gyp

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
{
2020
"variables": {
2121
"cflags_cpp": "/std:c++20",
22-
"arch%": "<!(echo %PROCESSOR_ARCHITECTURE%)",
22+
"arch%": "<!(node -e \"console.log(process.arch)\")",
2323
},
2424
},
2525
]
@@ -136,18 +136,9 @@
136136
"actions": [
137137
{
138138
"action_name": "print_variables",
139-
"conditions": [
140-
['OS=="win"', {
141-
"action": [
142-
"echo",
143-
"compiler: MSVC | cflags_cpp <(cflags_cpp) | arch: <(arch) | link_path: <(link_path) | msodbc_include_folders <(msodbc_include_folders) | fileset <(fileset)",
144-
],
145-
}, {
146-
"action": [
147-
"echo",
148-
"compiler: <!(echo ${CC:-gcc}) <!(echo ${CXX:-g++}) | cflags_cpp <(cflags_cpp) | arch: <(arch) | link_path: <(link_path) | msodbc_include_folders <(msodbc_include_folders) | fileset <(fileset)",
149-
],
150-
}]
139+
"action": [
140+
"node", "-p",
141+
"'compiler: ' + (process.platform === 'win32' ? 'MSVC' : (process.env.CXX || 'g++')) + ' | cflags_cpp <(cflags_cpp) | arch: <(arch) | link_path: <(link_path) | msodbc_include_folders <(msodbc_include_folders) | fileset <(fileset)'",
151142
],
152143
"inputs": [],
153144
"outputs": ["<!@(node -p \"'<(fileset)'.split(' ')[0]\")"],

0 commit comments

Comments
 (0)