From f37d5bade3c892c3ec36d2b3e1f3d4b2a9655aa2 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Sun, 31 May 2020 17:49:27 +1200 Subject: [PATCH] Database upgrade code does not require a tty --- src/lib/utils/upgradedb.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/utils/upgradedb.js b/src/lib/utils/upgradedb.js index 13295c8..c3a85a3 100644 --- a/src/lib/utils/upgradedb.js +++ b/src/lib/utils/upgradedb.js @@ -110,11 +110,16 @@ function writeProgress(i) { const size = deltas.size const progress = "=".repeat(i) + " ".repeat(deltas.size-i) const numberLength = String(deltas.size).length - process.stdout.cursorTo(0) + if (process.stdout.isTTY) { + process.stdout.cursorTo(0) + } process.stdout.write( `Creating database... (${String(i).padStart(numberLength, " ")}` +`/${String(size).padStart(numberLength, " ")}) [${progress}]` ) + if (!process.stdout.isTTY) { + process.stdout.write("\n") + } } async function createBackup(entry) {