Merge pull request #19515 from amcasey/DebugTI

Handle --debug-brk and --inspect-brk when launching TypingsInstaller
This commit is contained in:
Andrew Casey
2017-10-26 17:22:07 -07:00
committed by GitHub

View File

@@ -349,13 +349,13 @@ namespace ts.server {
const execArgv: string[] = [];
for (const arg of process.execArgv) {
const match = /^--(debug|inspect)(=(\d+))?$/.exec(arg);
const match = /^--((?:debug|inspect)(?:-brk)?)(?:=(\d+))?$/.exec(arg);
if (match) {
// if port is specified - use port + 1
// otherwise pick a default port depending on if 'debug' or 'inspect' and use its value + 1
const currentPort = match[3] !== undefined
? +match[3]
: match[1] === "debug" ? 5858 : 9229;
const currentPort = match[2] !== undefined
? +match[2]
: match[1].charAt(0) === "d" ? 5858 : 9229;
execArgv.push(`--${match[1]}=${currentPort + 1}`);
break;
}