Skip to content
Prev Previous commit
Next Next commit
Reverts parts of the changes
  • Loading branch information
arcanis committed Mar 29, 2022
commit f7d9aea701e63a33f06dfbdb5e44f9c6011a9f34
9 changes: 4 additions & 5 deletions packages/yarnpkg-cli/sources/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,15 @@ export async function main({binaryVersion, pluginConfiguration}: {binaryVersion:
return Buffer.of();
});

const isDifferentBinary = async () =>
yarnPath &&
yarnPath !== selfPath &&
const isSameBinary = async () =>
yarnPath === selfPath ||
Buffer.compare(...await Promise.all([
tryRead(yarnPath),
tryRead(selfPath),
])) !== 0;
])) === 0;

// Avoid unnecessary spawn when run directly
if (!ignorePath && !ignoreCwd && !await isDifferentBinary()) {
if (!ignorePath && !ignoreCwd && await isSameBinary()) {
process.env.YARN_IGNORE_PATH = `1`;
process.env.YARN_IGNORE_CWD = `1`;

Expand Down