Skip to content

Commit 6477e1e

Browse files
committed
fix: preserve script output lacking a final newline
1 parent 05dbba5 commit 6477e1e

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

lib/utils/display.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,9 +543,8 @@ class Progress {
543543
if (!this.#rendered) {
544544
return
545545
}
546-
// Move to the start of the line and clear the rest of the line
547-
this.#stream.cursorTo(0)
548-
this.#stream.clearLine(1)
546+
// Erase the last printed character
547+
this.#stream.write('\b \b')
549548
this.#rendered = false
550549
}
551550
}

test/lib/utils/display.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ t.test('can do progress', async (t) => {
9696
log.error('', 'after input')
9797
output.standard('after input')
9898

99-
t.strictSame([...new Set(outputErrors)].sort(), ['-', '/', '\\', '|'])
99+
t.strictSame([...new Set(outputErrors)].sort(), ['\b \b', '-', '/', '\\', '|'])
100100
t.strictSame(logs, ['error before input', 'error during input', 'error after input'])
101101
t.strictSame(outputs, ['before input', 'during input', 'after input'])
102102
})

0 commit comments

Comments
 (0)