Unverified Commit ccdb8697 authored by OJ Kwon's avatar OJ Kwon Committed by GitHub

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

<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:
-->

Partially resolves WEB-628

Starting next-dev relies on some stdout status to grab its devserver
url, and this PR correctly bubbles up custom turbopack binary's stdout
to make it work.
parent 725a4de0
...@@ -424,13 +424,17 @@ function loadNative(isCustomTurbopack = false) { ...@@ -424,13 +424,17 @@ function loadNative(isCustomTurbopack = false) {
let child = spawn(__INTERNAL_CUSTOM_TURBOPACK_BINARY, args, { let child = spawn(__INTERNAL_CUSTOM_TURBOPACK_BINARY, args, {
stdio: 'pipe', stdio: 'pipe',
env: {
...process.env,
},
}) })
child.on('message', (message: any) => { 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())
})
child.on('close', (code: any) => { child.on('close', (code: any) => {
if (code !== 0) { if (code !== 0) {
reject({ reject({
......
...@@ -461,7 +461,9 @@ If you cannot make the changes above, but still want to try out\nNext.js v13 wit ...@@ -461,7 +461,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: // Start preflight after server is listening and ignore errors:
preflight().catch(() => {}) preflight().catch(() => {})
await telemetry.flush() if (!isCustomTurbopack) {
await telemetry.flush()
}
return server return server
} else { } else {
// we're using a sub worker to avoid memory leaks. When memory usage exceeds 90%, we kill the worker and restart it. // we're using a sub worker to avoid memory leaks. When memory usage exceeds 90%, we kill the worker and restart it.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment