Skip to content

Commit

Permalink
coverage: pass cwd to path.resolve() in setup
Browse files Browse the repository at this point in the history
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: nodejs#25289
Fixes: nodejs#25287
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
cjihrig authored and refack committed Jan 10, 2019
1 parent e812e0d commit 4cfbcb0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/internal/process/coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit 4cfbcb0

Please sign in to comment.