Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: move loadEnvFile toNamespacedPath call #53658

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/internal/process/per_thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const {
validateObject,
} = require('internal/validators');
const { getValidatedPath } = require('internal/fs/utils');
const { toNamespacedPath } = require('path');
const constants = internalBinding('constants').os.signals;

const kInternal = Symbol('internal properties');
Expand Down Expand Up @@ -255,7 +254,7 @@ function wrapProcessMethods(binding) {
function loadEnvFile(path = undefined) { // Provide optional value so that `loadEnvFile.length` returns 0
if (path != null) {
path = getValidatedPath(path);
_loadEnvFile(toNamespacedPath(path));
_loadEnvFile(path);
} else {
_loadEnvFile();
}
Expand Down
4 changes: 3 additions & 1 deletion src/node_process_methods.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "node_external_reference.h"
#include "node_internals.h"
#include "node_process-inl.h"
#include "path.h"
#include "util-inl.h"
#include "uv.h"
#include "v8-fast-api-calls.h"
Expand Down Expand Up @@ -474,7 +475,8 @@ static void LoadEnvFile(const v8::FunctionCallbackInfo<v8::Value>& args) {
Environment* env = Environment::GetCurrent(args);
std::string path = ".env";
if (args.Length() == 1) {
Utf8Value path_value(args.GetIsolate(), args[0]);
BufferValue path_value(args.GetIsolate(), args[0]);
ToNamespacedPath(env, &path_value);
path = path_value.ToString();
}

Expand Down
Loading