refactor: use console.clear to clear the log (#5700)

Co-authored-by: chentao.arthur <chentao.arthur@bytedance.com>
This commit is contained in:
Arthur
2020-07-24 18:30:57 +08:00
committed by GitHub
parent 8f5691be8d
commit 7c2a36b889
+1 -5
View File
@@ -1,6 +1,5 @@
const chalk = require('chalk')
const stripAnsi = require('strip-ansi')
const readline = require('readline')
const EventEmitter = require('events')
const { stopSpinner } = require('./spinner')
@@ -59,10 +58,7 @@ exports.error = (msg, tag = null) => {
exports.clearConsole = title => {
if (process.stdout.isTTY) {
const blank = '\n'.repeat(process.stdout.rows)
console.log(blank)
readline.cursorTo(process.stdout, 0, 0)
readline.clearScreenDown(process.stdout)
console.clear()
if (title) {
console.log(title)
}