diff --git a/lib/configure.js b/lib/configure.js index 08b69026b3..2db43c7ed9 100644 --- a/lib/configure.js +++ b/lib/configure.js @@ -387,12 +387,16 @@ function configure (gyp, argv, callback) { output_dir = buildDir } - argv.push('-I', addon_gypi) - argv.push('-I', common_gypi) + function shellEscape(str) { + return str.replace(/(["\s'$`\\])/g, '\\$1'); + }; + + argv.push('-I', shellEscape(addon_gypi)) + argv.push('-I', shellEscape(common_gypi)) argv.push('-Dlibrary=shared_library') argv.push('-Dvisibility=default') - argv.push('-Dnode_root_dir=' + nodeDir) - argv.push('-Dmodule_root_dir=' + process.cwd()) + argv.push('-Dnode_root_dir=' + shellEscape(nodeDir)) + argv.push('-Dmodule_root_dir=' + shellEscape(process.cwd())) argv.push('--depth=.') // tell gyp to write the Makefile/Solution files into output_dir