Fix launching text editor from a redbox stacktrace on windows

Summary:
Launch the editor with cmd on windows.
Closes https://github.com/facebook/react-native/pull/5238

Reviewed By: svcscm

Differential Revision: D2819943

Pulled By: pcottle

fb-gh-sync-id: a38f88bb9be72871cc3a37367973371176799d9e
This commit is contained in:
Janic Duplessis 2016-01-11 13:27:00 -08:00 committed by facebook-github-bot-5
parent 05f31a0cbf
commit e08a7f3587
1 changed files with 7 additions and 1 deletions

View File

@ -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;