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

test(integration): properly pipe turbopack binary stdouts #46382

Merged
merged 1 commit into from
Feb 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions packages/next/src/build/swc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,17 @@ function loadNative(isCustomTurbopack = false) {

let child = spawn(__INTERNAL_CUSTOM_TURBOPACK_BINARY, args, {
stdio: 'pipe',
env: {
...process.env,
},
})
child.on('message', (message: any) => {
console.log(message)
require('console').log(message)
})
child.stdout.on('data', (data: any) => {
require('console').log(data.toString())
})
child.stderr.on('data', (data: any) => {
require('console').log(data.toString())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
require('console').log(data.toString())
require('console').error(data.toString())

Are we not writing this back to stderr on purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not intentionally, this was just good enough to ensure dev instance boots up correctly. Since this is internal testing purpose only, I assume it won't be huge blocker to not to polish these behavior (as long as it works).

})

child.on('close', (code: any) => {
if (code !== 0) {
reject({
Expand Down
4 changes: 3 additions & 1 deletion packages/next/src/cli/next-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,9 @@ If you cannot make the changes above, but still want to try out\nNext.js v13 wit
// Start preflight after server is listening and ignore errors:
preflight().catch(() => {})

await telemetry.flush()
if (!isCustomTurbopack) {
await telemetry.flush()
}
return server
} else {
// we're using a sub worker to avoid memory leaks. When memory usage exceeds 90%, we kill the worker and restart it.
Expand Down