From eb78cd550222c52466c06547d13a1f0bd76b7d19 Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Sun, 10 Jan 2016 14:54:25 -0500 Subject: [PATCH] Fix launching text editor from a redbox stacktrace on windows --- local-cli/server/util/launchEditor.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/local-cli/server/util/launchEditor.js b/local-cli/server/util/launchEditor.js index a456eda59d2638..ee84452941326b 100644 --- a/local-cli/server/util/launchEditor.js +++ b/local-cli/server/util/launchEditor.js @@ -125,7 +125,13 @@ function launchEditor(fileName, lineNumber) { _childProcess.kill('SIGKILL'); } - _childProcess = child_process.spawn(editor, args, {stdio: 'inherit'}); + if (process.platform === 'win32') { + // On Windows, launch the editor in a shell because spawn can only + // launch .exe files. + _childProcess = child_process.spawn('cmd.exe', ['/C', editor].concat(args), {stdio: 'inherit'}); + } else { + _childProcess = child_process.spawn(editor, args, {stdio: 'inherit'}); + } _childProcess.on('exit', function(errorCode) { _childProcess = null;