diff --git a/index.js b/index.js index f6bfec7..d81dce1 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -const exec = require('child_process').exec; +const exec = require('child_process').execFile; const COMMANDS = { darwin: 'open', @@ -10,7 +10,7 @@ const command = COMMANDS[process.platform] || 'xdg-open'; module.exports = function xopen(filepath) { return new Promise(function(resolve, reject) { - exec(command + ' ' + filepath, (error, stdout, stderr) => { + exec(command, [filepath], (error, stdout, stderr) => { if (error) { return reject(error); }