Skip to content

Commit f62a1fd

Browse files
authored
After clearing console, move the cursor to the top of terminal (#2593)
1 parent f9f31c7 commit f62a1fd

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.changeset/orange-rats-jog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@aws-amplify/cli-core': patch
3+
---
4+
5+
After clearing console, move the cursor to the top of terminal

packages/cli-core/src/printer/printer.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,12 @@ export class Printer {
181181
* Clears the console
182182
*/
183183
clearConsole = () => {
184-
if (this.ttyEnabled) {
185-
this.stdout.write('\n'.repeat(process.stdout.rows));
184+
if (!this.ttyEnabled) {
185+
return;
186186
}
187+
const lines = process.stdout.rows;
188+
this.stdout.write('\n'.repeat(process.stdout.rows));
189+
process.stdout.moveCursor(0, -lines);
187190
};
188191

189192
private stringify = (msg: unknown): string => {

0 commit comments

Comments
 (0)