Skip to content

Commit d41ed44

Browse files
anonrigaduh95
authored andcommitted
src: move loadEnvFile toNamespacedPath call
PR-URL: #53658 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 2c6548a commit d41ed44

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/internal/process/per_thread.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ const {
4747
validateObject,
4848
} = require('internal/validators');
4949
const { getValidatedPath } = require('internal/fs/utils');
50-
const { toNamespacedPath } = require('path');
5150
const constants = internalBinding('constants').os.signals;
5251

5352
const kInternal = Symbol('internal properties');
@@ -255,7 +254,7 @@ function wrapProcessMethods(binding) {
255254
function loadEnvFile(path = undefined) { // Provide optional value so that `loadEnvFile.length` returns 0
256255
if (path != null) {
257256
path = getValidatedPath(path);
258-
_loadEnvFile(toNamespacedPath(path));
257+
_loadEnvFile(path);
259258
} else {
260259
_loadEnvFile();
261260
}

src/node_process_methods.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "node_external_reference.h"
1010
#include "node_internals.h"
1111
#include "node_process-inl.h"
12+
#include "path.h"
1213
#include "util-inl.h"
1314
#include "uv.h"
1415
#include "v8-fast-api-calls.h"
@@ -474,7 +475,8 @@ static void LoadEnvFile(const v8::FunctionCallbackInfo<v8::Value>& args) {
474475
Environment* env = Environment::GetCurrent(args);
475476
std::string path = ".env";
476477
if (args.Length() == 1) {
477-
Utf8Value path_value(args.GetIsolate(), args[0]);
478+
BufferValue path_value(args.GetIsolate(), args[0]);
479+
ToNamespacedPath(env, &path_value);
478480
path = path_value.ToString();
479481
}
480482

0 commit comments

Comments
 (0)