From a4c0c2f206f48ae9da4facabf300664bdea71b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Thu, 26 Apr 2018 15:52:33 +0100 Subject: [PATCH] Fixes prettier --- packages/pkg-tests/pkg-tests-core/sources/utils/fs.js | 8 ++++++++ src/util/execute-lifecycle-script.js | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/pkg-tests/pkg-tests-core/sources/utils/fs.js b/packages/pkg-tests/pkg-tests-core/sources/utils/fs.js index 16310e1ffe..2871fb5b7f 100644 --- a/packages/pkg-tests/pkg-tests-core/sources/utils/fs.js +++ b/packages/pkg-tests/pkg-tests-core/sources/utils/fs.js @@ -173,3 +173,11 @@ exports.readJson = async function readJson(source: string): Promise { throw new Error(`Invalid json file (${source})`); } }; + +exports.makeFakeBinary = async function( + target: string, + {output = `Fake binary`, exitCode = 1}: {|output: string, exitCode: number|} = {}, +): Promise { + await exports.writeFile(target, `#!/bin/sh\necho "${output}"\nexit ${exitCode}\n`); + await exports.chmod(target, 0o755); +}; diff --git a/src/util/execute-lifecycle-script.js b/src/util/execute-lifecycle-script.js index edc81f176a..0307d9560d 100644 --- a/src/util/execute-lifecycle-script.js +++ b/src/util/execute-lifecycle-script.js @@ -141,11 +141,11 @@ export async function makeEnv( // split up the path const envPath = env[constants.ENV_PATH_KEY]; const pathParts = envPath ? envPath.split(path.delimiter) : []; - + // Include the directory that contains node so that we can guarantee that the scripts // will always run with the exact same Node release than the one use to run Yarn pathParts.unshift(path.dirname(process.execPath)); - + // Include node-gyp version that was bundled with the current Node.js version, // if available. pathParts.unshift(path.join(path.dirname(process.execPath), 'node_modules', 'npm', 'bin', 'node-gyp-bin'));