mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-16 15:51:35 -05:00
Merge pull request #40444 from amcasey/Cherry40043
Set stackTraceLimit to 0 in fileSystemEntryExists
This commit is contained in:
@@ -1662,6 +1662,11 @@ namespace ts {
|
||||
}
|
||||
|
||||
function fileSystemEntryExists(path: string, entryKind: FileSystemEntryKind): boolean {
|
||||
// Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
|
||||
// the CPU time performance.
|
||||
const originalStackTraceLimit = Error.stackTraceLimit;
|
||||
Error.stackTraceLimit = 0;
|
||||
|
||||
try {
|
||||
const stat = _fs.statSync(path);
|
||||
switch (entryKind) {
|
||||
@@ -1673,6 +1678,9 @@ namespace ts {
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
Error.stackTraceLimit = originalStackTraceLimit;
|
||||
}
|
||||
}
|
||||
|
||||
function fileExists(path: string): boolean {
|
||||
|
||||
Reference in New Issue
Block a user