diff --git a/src/logger.ts b/src/logger.ts index e4c0a9a..90e3554 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -6,6 +6,8 @@ import { ExtensionOutputChannelName } from './constants'; const ConsolePrefix = `[${ExtensionOutputChannelName}]`; +const isDebuggingRegex = /^--inspect(-brk)?=?/; + export class Logger { static debug = false; @@ -88,4 +90,17 @@ export class Logger { } this.gitOutput.appendLine(`${this.timestamp} ${command} (${cwd})${ex === undefined ? '' : `\n\n${ex.toString()}`}`); } + + private static _isDebugging: boolean | undefined; + static get isDebugging() { + if (this._isDebugging === undefined) { + const args = process.execArgv; + + this._isDebugging = args + ? args.some(arg => isDebuggingRegex.test(arg)) + : false; + } + + return this._isDebugging; + } } \ No newline at end of file