-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Disable ANR and Local Variables if debugger is enabled via CLI a…
…rgs (#14643)
- Loading branch information
Showing
5 changed files
with
70 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
let cachedDebuggerEnabled: boolean | undefined; | ||
|
||
/** | ||
* Was the debugger enabled when this function was first called? | ||
*/ | ||
export async function isDebuggerEnabled(): Promise<boolean> { | ||
if (cachedDebuggerEnabled === undefined) { | ||
try { | ||
// Node can be built without inspector support | ||
const inspector = await import('node:inspector'); | ||
cachedDebuggerEnabled = !!inspector.url(); | ||
} catch (_) { | ||
cachedDebuggerEnabled = false; | ||
} | ||
} | ||
|
||
return cachedDebuggerEnabled; | ||
} |