fix: on non tty streams

License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
This commit is contained in:
Henrique Dias 2020-07-19 13:16:53 +01:00
parent 583695828c
commit 3ba5c34afc
No known key found for this signature in database
GPG Key ID: EE928B18BCFBF9A9

View File

@ -1,7 +1,11 @@
const progress = (str) => { const progress = (str) => {
process.stdout.clearLine() if (process.stdout.isTTY) {
process.stdout.cursorTo(0) process.stdout.clearLine()
process.stdout.write(str) process.stdout.cursorTo(0)
process.stdout.write(str)
} else {
console.log(str)
}
} }
const pad = (str, max) => { const pad = (str, max) => {