Skip to content

Commit d6626fb

Browse files
committed
Potentially save some compute before calculating regex
1 parent b3f3359 commit d6626fb

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/features/terminal/utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ export async function waitForShellIntegration(terminal: Terminal): Promise<boole
6969

7070
// Detects if the given text content appears to end with a common prompt pattern.
7171
function detectsCommonPromptPattern(terminalData: string): boolean {
72+
if (terminalData.trim().length === 0) {
73+
return false;
74+
}
75+
7276
const sanitizedTerminalData = removeAnsiEscapeCodes(terminalData);
7377
// PowerShell prompt: PS C:\> or similar patterns
7478
if (/PS\s+[A-Z]:\\.*>\s*$/.test(sanitizedTerminalData)) {

0 commit comments

Comments
 (0)