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

Ensure additional windows are not created on Windows OS #45022

Merged
merged 1 commit into from
Jan 19, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/next/src/cli/next-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,9 @@ If you cannot make the changes above, but still want to try out\nNext.js v13 wit
return () => cluster.removeListener('exit', callback)
}
let clusterExitUnsub = handleClusterExit()
// x-ref: https://nodejs.org/api/cluster.html#clustersettings
// @ts-expect-error type is incorrect
cluster.settings.windowsHide = true
cluster.settings.stdio = ['ipc', 'pipe', 'pipe']

setupFork()
Expand Down
1 change: 1 addition & 0 deletions packages/next/src/telemetry/project-id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function _getProjectIdByGit() {
{
timeout: 1000,
stdio: `pipe`,
windowsHide: true,
}
)

Expand Down
8 changes: 6 additions & 2 deletions packages/next/src/telemetry/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import { _postPayload } from './post-payload'
import { getRawProjectId } from './project-id'
import { AbortController } from 'next/dist/compiled/@edge-runtime/primitives/abort-controller'
import fs from 'fs'
import spawn from 'next/dist/compiled/cross-spawn'
// Note: cross-spawn is not used here as it causes
// a new command window to appear when we don't want it to
import { spawn } from 'child_process'

// This is the key that stores whether or not telemetry is enabled or disabled.
const TELEMETRY_KEY_ENABLED = 'telemetry.enabled'
Expand Down Expand Up @@ -245,8 +247,10 @@ export class Telemetry {
JSON.stringify(allEvents)
)

spawn('node', [require.resolve('./deteched-flush'), mode, dir], {
spawn(process.execPath, [require.resolve('./deteched-flush'), mode, dir], {
detached: !this.NEXT_TELEMETRY_DEBUG,
windowsHide: true,
shell: false,
...(this.NEXT_TELEMETRY_DEBUG
? {
stdio: 'inherit',
Expand Down