-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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: allow absolute paths for --env-file
#49232
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,6 +124,7 @@ | |
#include <cstdio> | ||
#include <cstdlib> | ||
#include <cstring> | ||
#include <filesystem> | ||
|
||
#include <string> | ||
#include <tuple> | ||
|
@@ -858,8 +859,12 @@ static ExitCode InitializeNodeWithArgsInternal( | |
auto cwd = Environment::GetCwd(Environment::GetExecPath(*argv)); | ||
|
||
for (const auto& file_path : file_paths) { | ||
std::string path = cwd + kPathSeparator + file_path; | ||
per_process::dotenv_file.ParsePath(path); | ||
if (file_path.is_absolute()) { | ||
per_process::dotenv_file.ParsePath(file_path.string()); | ||
} else { | ||
std::string path = cwd + kPathSeparator + file_path.string(); | ||
per_process::dotenv_file.ParsePath(path); | ||
} | ||
Comment on lines
-861
to
+867
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a comment explaining why it is necessary to construct an absolute path here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see why any of this is necessary, so I've opened #51425 as an alternative. |
||
} | ||
|
||
per_process::dotenv_file.AssignNodeOptionsIfAvailable(&node_options); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend adding a comment here that
<filesystem>
is imported only to support path-processing operations and not actually performing any file system operations (which should always go through libuv)