keeweb/build/util/hook-rcedit.js

22 lines
578 B
JavaScript
Raw Normal View History

const childProcess = require('child_process');
// remove this once wine can be run on macOS
const childProcessSpawn = childProcess.spawn;
2019-10-10 23:49:51 +02:00
function hookedSpawn(command, options, ...args) {
if (command === 'wine') {
options = options.map(option => {
if (option.includes(' ')) {
option = `"${option.replace('"', '\\"')}"`;
}
return option;
});
}
2019-10-10 23:49:51 +02:00
return childProcessSpawn.call(childProcess, command, options, ...args);
}
module.exports.setup = function() {
childProcess.spawn = hookedSpawn;
};