From 3df8274bf03fbfe75114781e160b33874cd73c3f Mon Sep 17 00:00:00 2001 From: OJ Kwon Date: Mon, 27 Feb 2017 15:09:22 -0800 Subject: [PATCH] Falls back to default shell to install plugin on win32 (#1565) - related to #1480 --- app/plugins.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/app/plugins.js b/app/plugins.js index 636a94c188e5..64e52901d3c6 100644 --- a/app/plugins.js +++ b/app/plugins.js @@ -242,12 +242,20 @@ function install(fn) { }; // determine the shell we're running in const whichShell = (typeof cfgShell === 'string' && cfgShell.match(/fish/)) ? 'fish' : 'posix'; - // Use the install command that is appropriate for our shell - exec(installCommands[whichShell], { + const execOptions = { cwd: path, - env, - shell - }, err => { + env + }; + + // https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback + // node.js requires command line parsing should be compatible with cmd.exe on Windows, should able to accept `/d /s /c` + // but most custom shell doesn't. Instead, falls back to default shell + if (process.platform !== 'win32') { + execOptions.shell = shell; + } + + // Use the install command that is appropriate for our shell + exec(installCommands[whichShell], execOptions, err => { if (err) { return fn(err); }