Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only read from stdin when using —input - #14116

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/cli/build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ export async function build(args) {
process.stdin.on('end', () => process.exit(0))
}

process.stdin.resume()

await processor.watch()
} else {
await processor.build().catch((e) => {
Expand Down
8 changes: 6 additions & 2 deletions src/cli/build/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ export async function readFileWithRetries(path, tries = 5) {
export function drainStdin() {
return new Promise((resolve, reject) => {
let result = ''
process.stdin.on('data', (chunk) => {
result += chunk
process.stdin.on('readable', () => {
while (true) {
let chunk = process.stdin.read()
if (chunk === null) break
result += chunk
}
})
process.stdin.on('end', () => resolve(result))
process.stdin.on('error', (err) => reject(err))
Expand Down
Loading