Skip to content

Commit

Permalink
[windows:ci] handle CLI output in a cross-compat way (#2801)
Browse files Browse the repository at this point in the history
* handle readline in a cross-compat way

* Create modern-feet-lay.md
  • Loading branch information
FredKSchott committed Mar 15, 2022
1 parent fc50fbb commit 11fb374
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/modern-feet-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Fix: Handle CLI output in a cross-compat way
7 changes: 4 additions & 3 deletions packages/astro/src/core/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { bold, cyan, dim, red, grey, underline, yellow, reset } from 'kleur/colo
import { performance } from 'perf_hooks';
import { Writable } from 'stream';
import stringWidth from 'string-width';
import * as readline from 'readline';
import debugPackage from 'debug';
import { format as utilFormat } from 'util';

Expand Down Expand Up @@ -69,9 +70,9 @@ export const defaultLogDestination = new Writable({
lines = Math.ceil(len / cols);
}
for (let i = 0; i < lines; i++) {
(dest as typeof process.stdout).clearLine(0);
(dest as typeof process.stdout).cursorTo(0);
(dest as typeof process.stdout).moveCursor(0, -1);
readline.clearLine(dest, 0);
readline.cursorTo(dest, 0);
readline.moveCursor(dest, 0, -1);
}
}
message = `${message} ${yellow(`(x${lastMessageCount})`)}`;
Expand Down

0 comments on commit 11fb374

Please sign in to comment.