From adcc13d474e6afe34cfd2e05d1d951ef606d02a7 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Thu, 7 Jul 2016 13:31:44 -0400 Subject: [PATCH] fix(GUI): escape image path spaces correctly on Windows (#560) The `elevator` module passes its arguments directly to `child_process.execFile()`, which handles escaping spaces and other weird issues by default. Instead of passing a separate argument for every word of the writer proxy script command, we passed the whole thing at once, which means we didn't get the escaping features by default. Change-Type: patch Changelog-Entry: Fix flashing not starting when an image name contains a space. Signed-off-by: Juan Cruz Viotti --- lib/src/child-writer/writer-proxy.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/src/child-writer/writer-proxy.js b/lib/src/child-writer/writer-proxy.js index cb2893ee..d22869eb 100644 --- a/lib/src/child-writer/writer-proxy.js +++ b/lib/src/child-writer/writer-proxy.js @@ -82,17 +82,18 @@ return isElevated().then((elevated) => { const elevator = Bluebird.promisifyAll(require('elevator')); return elevator.executeAsync([ - [ + 'set', + 'ELECTRON_RUN_AS_NODE=1', + '&&', + 'set', + `${CONSTANTS.TEMPORARY_LOG_FILE_ENVIRONMENT_VARIABLE}=${logFile}`, + '&&', - 'set ELECTRON_RUN_AS_NODE=1 &&', - `set ${CONSTANTS.TEMPORARY_LOG_FILE_ENVIRONMENT_VARIABLE}=${logFile} &&`, + // This is a trick to make the binary afterwards catch + // the environment variables set just previously. + 'call' - // This is a trick to make the binary afterwards catch - // the environment variables set just previously. - 'call' - - ].concat(process.argv).join(' ') - ], { + ].concat(process.argv), { hidden: true, terminating: true, doNotPushdCurrentDirectory: true,