Skip to content

Commit

Permalink
configure.js: escape '<'
Browse files Browse the repository at this point in the history
On windows invoking spawn on a batch file results in additional
argument processing. Special characters need to be escaped (twice).

fixes #1501 (comment)
  • Loading branch information
yeerkkiller1 committed Jul 19, 2018
1 parent 50b8734 commit 86cddc1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 86cddc1

Please sign in to comment.