From 0213d0ac09c3f0f0f65543c29b9909d34f7c8044 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 30 Dec 2018 19:47:47 -0500 Subject: [PATCH] coverage: pass cwd to path.resolve() in setup During coverage setup, path.resolve() is called. path.resolve() can potentially call process.cwd(), which hasn't been bootstrapped yet. This commit passes the current working directory directly so that path.resolve() doesn't attempt to compute it. PR-URL: https://github.com/nodejs/node/pull/25289 Fixes: https://github.com/nodejs/node/issues/25287 Reviewed-By: Anna Henningsen Reviewed-By: Gus Caplan Reviewed-By: Yuta Hiroto Reviewed-By: Joyee Cheung Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Backport-PR-URL: https://github.com/nodejs/node/pull/25496 --- lib/internal/process/coverage.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/internal/process/coverage.js b/lib/internal/process/coverage.js index c84181db933334..ef37deba8a5f58 100644 --- a/lib/internal/process/coverage.js +++ b/lib/internal/process/coverage.js @@ -76,9 +76,10 @@ function setup() { })); try { + const { cwd } = internalBinding('process_methods'); const { resolve } = require('path'); coverageDirectory = process.env.NODE_V8_COVERAGE = - resolve(process.env.NODE_V8_COVERAGE); + resolve(cwd(), process.env.NODE_V8_COVERAGE); } catch (err) { process._rawDebug(err.toString()); }