2019-10-09 22:54:32 +02:00
|
|
|
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) {
|
2019-10-09 22:54:32 +02:00
|
|
|
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);
|
2019-10-09 22:54:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports.setup = function() {
|
|
|
|
childProcess.spawn = hookedSpawn;
|
|
|
|
};
|