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

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

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

Expand Down