Skip to content

Commit

Permalink
Fix launching text editor from a redbox stacktrace on windows
Browse files Browse the repository at this point in the history
Summary:
Launch the editor with cmd on windows.
Closes facebook#5238

Reviewed By: svcscm

Differential Revision: D2819943

Pulled By: pcottle

fb-gh-sync-id: a38f88bb9be72871cc3a37367973371176799d9e
  • Loading branch information
janicduplessis authored and facebook-github-bot-5 committed Jan 11, 2016
1 parent 05f31a0 commit e08a7f3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion local-cli/server/util/launchEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit e08a7f3

Please sign in to comment.