From 86cddc18928e162c7a9ea520031b64d07608e279 Mon Sep 17 00:00:00 2001 From: yeerkkiller1 Date: Wed, 18 Jul 2018 21:43:07 -0400 Subject: [PATCH] configure.js: escape '<' On windows invoking spawn on a batch file results in additional argument processing. Special characters need to be escaped (twice). fixes https://github.com/nodejs/node-gyp/issues/1501#issuecomment-405944717 --- lib/configure.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/configure.js b/lib/configure.js index f4820b514b..1d0b654e01 100644 --- a/lib/configure.js +++ b/lib/configure.js @@ -291,9 +291,16 @@ function configure (gyp, argv, callback) { // Windows expects an absolute path output_dir = buildDir } + + var target_arch_gyp_variable = '<(target_arch)'; + if (process.platform === 'win32' && python.toLowerCase().endsWith('.bat')) { + // Windows will interpret python as a batch file, so we need to escape the '<' character + target_arch_gyp_variable = '^^^<(target_arch)' + } + var nodeGypDir = path.resolve(__dirname, '..') var nodeLibFile = path.join(nodeDir, - !gyp.opts.nodedir ? '<(target_arch)' : '$(Configuration)', + !gyp.opts.nodedir ? target_arch_gyp_variable : '$(Configuration)', release.name + '.lib') argv.push('-I', addon_gypi)