Skip to content

Commit ddc02c8

Browse files
FrozenPandazclaude
andcommitted
fix(core): set windowsHide: true on all child process spawns
On Windows, child_process.spawn/fork/exec default to windowsHide: false, which creates a visible console window for each subprocess. This causes command prompt windows to flash during project graph creation and task execution. This change sets windowsHide: true across all spawn/fork/exec calls in the codebase and adds a custom ESLint rule (@nx/workspace/require-windows-hide) to enforce this going forward. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 44db03a commit ddc02c8

File tree

123 files changed

+411
-150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+411
-150
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@
7676
]
7777
}
7878
],
79-
"@nx/workspace/valid-command-object": "error"
79+
"@nx/workspace/valid-command-object": "error",
80+
"@nx/workspace/require-windows-hide": "error"
8081
}
8182
},
8283
{

astro-docs/src/plugins/utils/cnw-generation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export async function loadCnwPackage(
4040
const child = fork(subprocessPath, [], {
4141
cwd: workspaceRoot,
4242
silent: true,
43+
windowsHide: true,
4344
});
4445

4546
let stdout = '';

astro-docs/src/plugins/utils/nx-cli-generation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export async function loadNxCliPackage(
4242
cwd: workspaceRoot,
4343
silent: true,
4444
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
45+
windowsHide: true,
4546
});
4647

4748
child.on('message', (message: any) => {

packages/create-nx-workspace/src/utils/child-process-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function spawnAndWait(command: string, args: string[], cwd: string) {
2525
ESLINT_USE_FLAT_CONFIG: process.env.ESLINT_USE_FLAT_CONFIG ?? 'true',
2626
},
2727
shell: true,
28-
windowsHide: false,
28+
windowsHide: true,
2929
});
3030

3131
childProcess.on('exit', (code, signal) => {
@@ -50,7 +50,7 @@ export function execAndWait(
5050
{
5151
cwd,
5252
env: { ...process.env, NX_DAEMON: 'false' },
53-
windowsHide: false,
53+
windowsHide: true,
5454
maxBuffer: 1024 * 1024 * 10, // 10MB — default 1MB can be exceeded by verbose PM output
5555
},
5656
(error, stdout, stderr) => {

packages/create-nx-workspace/src/utils/git/default-base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export function deduceDefaultBase(): string {
88
const nxDefaultBase = 'main';
99
try {
1010
return (
11-
execSync('git config --get init.defaultBranch', { windowsHide: false })
11+
execSync('git config --get init.defaultBranch', { windowsHide: true })
1212
.toString()
1313
.trim() || nxDefaultBase
1414
);

packages/create-nx-workspace/src/utils/git/git.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export async function checkGitVersion(): Promise<string | null | undefined> {
3636
*/
3737
export function isGitAvailable(): boolean {
3838
try {
39-
execSync('git --version', { stdio: 'ignore' });
39+
execSync('git --version', { stdio: 'ignore', windowsHide: true });
4040
return true;
4141
} catch {
4242
return false;
@@ -49,7 +49,7 @@ export function isGitAvailable(): boolean {
4949
*/
5050
export function isGhCliAvailable(): boolean {
5151
try {
52-
execSync('gh --version', { stdio: 'ignore' });
52+
execSync('gh --version', { stdio: 'ignore', windowsHide: true });
5353
return true;
5454
} catch {
5555
return false;

packages/create-nx-workspace/src/utils/nx/ab-testing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ function shouldRecordStats(): boolean {
370370
// Use npm to check registry - this works regardless of which package manager invoked us
371371
const stdout = execSync('npm config get registry', {
372372
encoding: 'utf-8',
373-
windowsHide: false,
373+
windowsHide: true,
374374
});
375375
const url = new URL(stdout.trim());
376376

packages/create-nx-workspace/src/utils/package-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export function getPackageManagerVersion(
266266
const version = execSync(`${packageManager} --version`, {
267267
cwd,
268268
encoding: 'utf-8',
269-
windowsHide: false,
269+
windowsHide: true,
270270
}).trim();
271271
pmVersionCache.set(packageManager, version);
272272
return version;

packages/cypress/plugins/cypress-preset.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ function startWebServer(webServerCommand: string) {
7777
// Windows is fine so we leave it attached to this process
7878
detached: process.platform !== 'win32',
7979
stdio: 'inherit',
80-
windowsHide: false,
80+
windowsHide: true,
8181
});
8282

8383
return async () => {
8484
if (process.platform === 'win32') {
8585
try {
8686
execSync('taskkill /pid ' + serverProcess.pid + ' /T /F', {
87-
windowsHide: false,
87+
windowsHide: true,
8888
});
8989
} catch (e) {
9090
if (process.env.NX_VERBOSE_LOGGING === 'true') {

packages/detox/src/executors/build/build.impl.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export function runCliBuild(
4141
{
4242
cwd: pathResolve(workspaceRoot, projectRoot),
4343
env: process.env,
44+
windowsHide: true,
4445
}
4546
);
4647

0 commit comments

Comments
 (0)