summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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})`)}`;