From d4a59d807391ec49813ee3d2f32b18f3de11e9cc Mon Sep 17 00:00:00 2001 From: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com> Date: Tue, 1 Sep 2026 15:19:03 +0300 Subject: [PATCH] Build/Test Tools: Copy local environment configuration synchronously. Backport of [62871] to the 6.7 branch. `start.js` copied `.env.example` asynchronously, then read `.env` on the next line. On a fresh checkout the read can win, and the process then runs with no configuration. Copy synchronously instead, guarded by `existsSync`, so `.env` exists before `dotenv.config()` runs. Dropping the swallow-all callback also lets a real copy error surface. --- tools/local-env/scripts/start.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/local-env/scripts/start.js b/tools/local-env/scripts/start.js index ef7fb7b7d4360..c1344c901df0a 100644 --- a/tools/local-env/scripts/start.js +++ b/tools/local-env/scripts/start.js @@ -2,12 +2,12 @@ const dotenv = require( 'dotenv' ); const dotenvExpand = require( 'dotenv-expand' ); const { execSync } = require( 'child_process' ); const local_env_utils = require( './utils' ); -const { constants, copyFile } = require( 'node:fs' ); +const { copyFileSync, existsSync } = require( 'node:fs' ); // Copy the default .env file when one is not present. -copyFile( '.env.example', '.env', constants.COPYFILE_EXCL, (e) => { - console.log( '.env file already exists. .env.example was not copied.' ); -}); +if ( ! existsSync( '.env' ) ) { + copyFileSync( '.env.example', '.env' ); +} dotenvExpand.expand( dotenv.config() );