Skip to content

Commit

Permalink
fix: restore cli cursor on unexpected exits
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Nov 18, 2024
1 parent 164e52f commit 0592f39
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
"expect-type": "^1.1.0",
"magic-string": "^0.30.12",
"pathe": "^1.1.2",
"restore-cursor": "^5.1.0",
"std-env": "^3.8.0",
"tinybench": "^2.9.0",
"tinyexec": "^0.3.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Writable } from 'node:stream'
import type { Vitest } from '../../core'
import { stripVTControlCharacters } from 'node:util'
import restoreCursor from 'restore-cursor'

const DEFAULT_RENDER_INTERVAL = 16

Expand Down Expand Up @@ -50,6 +51,9 @@ export class WindowRenderer {
this.interceptStream(process.stderr, 'error'),
)

restoreCursor()
this.write(HIDE_CURSOR, 'output')

this.start()
}

Expand Down Expand Up @@ -129,7 +133,6 @@ export class WindowRenderer {

this.write(windowContent.join('\n'))
this.write(SYNC_END)
this.write(HIDE_CURSOR)

this.windowHeight = rowCount + Math.max(0, padding)
}
Expand Down
26 changes: 26 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0592f39

Please sign in to comment.