From f98af61a18263e223fd0c1bb7242323820afe2bb Mon Sep 17 00:00:00 2001 From: Craigory Coppola Date: Tue, 11 Oct 2022 11:06:45 -0400 Subject: [PATCH] fix(core): hide leaky error message from git show command in affected (#12521) (cherry picked from commit f37c334ea4bc5c03427a1e175c2c49397760832e) --- packages/nx/src/project-graph/file-utils.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/nx/src/project-graph/file-utils.ts b/packages/nx/src/project-graph/file-utils.ts index 2aae12c2ce6511..b4f2bc1e00d261 100644 --- a/packages/nx/src/project-graph/file-utils.ts +++ b/packages/nx/src/project-graph/file-utils.ts @@ -89,9 +89,9 @@ export function calculateFileChanges( } switch (ext) { case '.json': - const atBase = readFileAtRevision(f, nxArgs.base); - const atHead = readFileAtRevision(f, nxArgs.head); try { + const atBase = readFileAtRevision(f, nxArgs.base); + const atHead = readFileAtRevision(f, nxArgs.head); return jsonDiff(JSON.parse(atBase), JSON.parse(atHead)); } catch (e) { return [new WholeFileChange()]; @@ -122,6 +122,7 @@ function defaultReadFileAtRevision( ? readFileSync(file, 'utf-8') : execSync(`git show ${revision}:${filePathInGitRepository}`, { maxBuffer: TEN_MEGABYTES, + stdio: ['pipe', 'pipe', 'ignore'], }) .toString() .trim();