MCPcopy Index your code
hub / github.com/microsoft/vscode-cpptools / lastNonemptyLine

Function lastNonemptyLine

Extension/src/SSH/sshCommandRunner.ts:515–538  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

513}
514
515function lastNonemptyLine(str: string): string | undefined {
516 const lines: string[] = splitLines(str);
517
518 if (isWindows) {
519 let outputContainingPipeError: string = '';
520 for (let i: number = lines.length - 1; i >= 0; i--) {
521 const strippedLine: string = stripEscapeSequences(lines[i]);
522 if (strippedLine.match(/The process tried to write to a nonexistent pipe/)) {
523 outputContainingPipeError = strippedLine;
524 continue;
525 }
526 if (strippedLine) {
527 return strippedLine;
528 }
529 }
530
531 if (outputContainingPipeError) {
532 return outputContainingPipeError;
533 }
534 }
535
536 const nonEmptyLines: string[] = lines.filter(l => !!l);
537 return nonEmptyLines[nonEmptyLines.length - 1];
538}

Callers 1

doneFunction · 0.85

Calls 3

splitLinesFunction · 0.90
stripEscapeSequencesFunction · 0.90
filterMethod · 0.45

Tested by

no test coverage detected