diff --git a/lib/src/child-writer/writer-proxy.js b/lib/src/child-writer/writer-proxy.js index 2ce8915708..fd683996ff 100644 --- a/lib/src/child-writer/writer-proxy.js +++ b/lib/src/child-writer/writer-proxy.js @@ -131,6 +131,12 @@ return isElevated().then((elevated) => { if (process.env.APPIMAGE && process.env.APPDIR) { const mountPoint = process.env.APPDIR + '-elevated'; + // Translate the current arguments to + // point to the new mount location. + const translatedArguments = _.map(process.argv, (argv) => { + return argv.replace(process.env.APPDIR, mountPoint); + }); + // We wrap the command with `sh -c` since it seems // the only way to effectively run many commands // with a graphical sudo interface, @@ -155,13 +161,7 @@ return isElevated().then((elevated) => { '&&' ] .concat(commandPrefix) - - // Translate the current arguments to - // point to the new mount location. - .concat(_.map(process.argv, (argv) => { - return argv.replace(process.env.APPDIR, mountPoint); - })) - + .concat(utils.escapeWhiteSpacesFromArguments(translatedArguments)) .concat([ ';',