Merge pull request #1062 from realm/blagoev/fix-RN-debug-with-vscode

Return debugger context if running on node in vscode debugger
This commit is contained in:
blagoev 2017-06-13 12:27:45 +03:00 committed by GitHub
commit 416632c9ad
1 changed files with 6 additions and 0 deletions

View File

@ -27,6 +27,12 @@ function getContext() {
// If process is an object, we're probably running in Node or Electron // If process is an object, we're probably running in Node or Electron
// From: http://stackoverflow.com/a/24279593/1417293 // From: http://stackoverflow.com/a/24279593/1417293
if (typeof process === 'object' && process + '' === '[object process]') { if (typeof process === 'object' && process + '' === '[object process]') {
// Visual Studio Code defines the global.__debug__ object.
if (typeof global !== 'undefined' && global.__debug__) {
return 'vscodedebugger';
}
return process.type === 'renderer' ? 'electron' : 'nodejs'; return process.type === 'renderer' ? 'electron' : 'nodejs';
} }