diff --git a/Gruntfile.js b/Gruntfile.js index 5b720723..c8d427de 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -5,6 +5,9 @@ const path = require('path'); const webpackConfig = require('./build/webpack.config'); const pkg = require('./package.json'); +const hookRcedit = require('./build/util/hook-rcedit'); + +hookRcedit.setup(); module.exports = function(grunt) { require('time-grunt')(grunt); diff --git a/build/util/hook-rcedit.js b/build/util/hook-rcedit.js new file mode 100644 index 00000000..035ae44b --- /dev/null +++ b/build/util/hook-rcedit.js @@ -0,0 +1,21 @@ +const childProcess = require('child_process'); + +// remove this once wine can be run on macOS + +const childProcessSpawn = childProcess.spawn; + +function hookedSpawn(command, options) { + if (command === 'wine') { + options = options.map(option => { + if (option.includes(' ')) { + option = `"${option.replace('"', '\\"')}"`; + } + return option; + }); + } + return childProcessSpawn.call(childProcess, command, options); +} + +module.exports.setup = function() { + childProcess.spawn = hookedSpawn; +};