summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Fred K. Schott <fkschott@gmail.com> 2022-03-15 10:30:25 -0700
committerGravatar GitHub <noreply@github.com> 2022-03-15 10:30:25 -0700
commit11fb3745dd548c6a8fa94c6a29e0ee89bac591aa (patch)
tree13728c7e3dcaeefcea6e4a5dc567a6cc6013bcdf
parentfc50fbb47a16187827e2ec9b8b0e67da55e23170 (diff)
downloadastro-11fb3745dd548c6a8fa94c6a29e0ee89bac591aa.tar.gz
astro-11fb3745dd548c6a8fa94c6a29e0ee89bac591aa.tar.zst
astro-11fb3745dd548c6a8fa94c6a29e0ee89bac591aa.zip
[windows:ci] handle CLI output in a cross-compat way (#2801)
* handle readline in a cross-compat way * Create modern-feet-lay.md
-rw-r--r--.changeset/modern-feet-lay.md5
-rw-r--r--packages/astro/src/core/logger.ts7
2 files changed, 9 insertions, 3 deletions
diff --git a/.changeset/modern-feet-lay.md b/.changeset/modern-feet-lay.md
new file mode 100644
index 000000000..f72cb4658
--- /dev/null
+++ b/.changeset/modern-feet-lay.md
@@ -0,0 +1,5 @@
+---
+"astro": patch
+---
+
+Fix: Handle CLI output in a cross-compat way
diff --git a/packages/astro/src/core/logger.ts b/packages/astro/src/core/logger.ts
index 2f3620579..44b06834b 100644
--- a/packages/astro/src/core/logger.ts
+++ b/packages/astro/src/core/logger.ts
@@ -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';
@@ -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})`)}`;