(str: string)
| 513 | } |
| 514 | |
| 515 | function 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 | } |
no test coverage detected