Skip to content

Commit

Permalink
fix(cli): default watchStdin to !process.stdin.isTTY
Browse files Browse the repository at this point in the history
Fixes the issue with running Vite under Elixir and doesn't cause issues
when running Vite programmatically [1]

[1] #4079
  • Loading branch information
stevehodgkiss committed Dec 29, 2024
1 parent cf10efd commit 3ce8058
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/vite/src/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ cli
'--force',
`[boolean] force the optimizer to ignore the cache and re-bundle`,
)
.option('--watchStdin', `[boolean] watch stdin and exit on EOF`)
.option('--watchStdin', `[boolean] watch stdin and exit on EOF`, {
default: !process.stdin.isTTY,
})
.action(async (root: string, options: ServerOptions & GlobalCLIOptions) => {
filterDuplicateOptions(options)
// output structure is preserved even after bundling so require()
Expand Down Expand Up @@ -365,7 +367,9 @@ cli
.option('--strictPort', `[boolean] exit if specified port is already in use`)
.option('--open [path]', `[boolean | string] open browser on startup`)
.option('--outDir <dir>', `[string] output directory (default: dist)`)
.option('--watchStdin', `[boolean] watch stdin and exit on EOF`)
.option('--watchStdin', `[boolean] watch stdin and exit on EOF`, {
default: !process.stdin.isTTY,
})
.action(
async (
root: string,
Expand Down

0 comments on commit 3ce8058

Please sign in to comment.