Skip to content

Commit 41769ef

Browse files
committed
Correct the non-regular-file rationale in the reuse source check
Fresh resolution does read FIFO env sources (1Password Environments), so the fallback is right because a pipe's content can't be verified without a side-effectful read, not because the loader would skip it.
1 parent 71bfa43 commit 41769ef

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

packages/varlock/src/lib/injected-env-reuse.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,13 @@ export function evaluateInjectedEnvReuse(opts: {
221221
const sourceFullPath = path.resolve(parsedEnv.basePath, source.path);
222222
let currentContents: string;
223223
try {
224-
// stat-gate before reading - some tools drop FIFOs where env files live (see the
225-
// wrangler FIFO handling in the loader) and readFileSync on one would hang forever.
226-
// A fresh resolution skips non-regular files too, so re-resolving is the right call.
224+
// stat-gate before reading - env sources can legitimately be FIFOs (e.g. 1Password
225+
// Environments serves .env files as pipes), and reading one here would have side
226+
// effects (the serving process rewrites it) or block forever on a writerless pipe.
227+
// A non-regular file's content can't be verified without reading it, so fall back
228+
// to a fresh resolution, which reads it once the same way any normal load does.
227229
if (!fs.statSync(sourceFullPath).isFile()) {
228-
return { reuse: false, reason: `source file ${source.path} is no longer a regular file` };
230+
return { reuse: false, reason: `source ${source.path} is not a regular file` };
229231
}
230232
currentContents = fs.readFileSync(sourceFullPath, 'utf8');
231233
} catch {

0 commit comments

Comments
 (0)