Skip to content

Commit

Permalink
fix: set worker process to tty
Browse files Browse the repository at this point in the history
  • Loading branch information
fi3ework committed Jul 17, 2021
1 parent 6244825 commit e46de1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 4 additions & 0 deletions packages/vite-plugin-checker/src/Checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import chokidar from 'chokidar'
import type {} from 'vite'
import type { CreateDiagnostic, BuildInCheckers } from './types'

if (!isMainThread) {
process.stdout.isTTY = true
}

export interface CheckerMeta<T extends BuildInCheckerNames> {
name: string
absFilePath: string
Expand Down
5 changes: 1 addition & 4 deletions packages/vite-plugin-checker/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,7 @@ export function createFrame({
source: string
location: SourceLocation
}) {
const frame = codeFrameColumns(source, location, {
// worker tty did not fork parent process stdout, let's make a workaround
forceColor: true,
})
const frame = codeFrameColumns(source, location)
.split('\n')
.map((line) => ' ' + line)
.join(os.EOL)
Expand Down

0 comments on commit e46de1c

Please sign in to comment.