| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -865,11 +865,9 @@ static ExitCode InitializeNodeWithArgsInternal( | |||
| 865 | 865 | ||
| 866 | 866 | if (!file_paths.empty()) { | |
| 867 | 867 | CHECK(!per_process::v8_initialized); | |
| 868 | - auto cwd = Environment::GetCwd(Environment::GetExecPath(*argv)); | ||
| 869 | 868 | ||
| 870 | 869 | for (const auto& file_path : file_paths) { | |
| 871 | - std::string path = cwd + kPathSeparator + file_path; | ||
| 872 | - auto path_exists = per_process::dotenv_file.ParsePath(path); | ||
| 870 | + bool path_exists = per_process::dotenv_file.ParsePath(file_path); | ||
| 873 | 871 | ||
| 874 | 872 | if (!path_exists) errors->push_back(file_path + ": not found"); | |
| 875 | 873 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,6 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | 3 | const common = require('../common'); | |
| 4 | 4 | const assert = require('node:assert'); | |
| 5 | + const path = require('node:path'); | ||
| 5 | 6 | const { describe, it } = require('node:test'); | |
| 6 | 7 | ||
| 7 | 8 | const validEnvFilePath = '../fixtures/dotenv/valid.env'; | |
@@ -25,6 +26,18 @@ describe('.env supports edge cases', () => { | |||
| 25 | 26 | assert.strictEqual(child.code, 0); | |
| 26 | 27 | }); | |
| 27 | 28 | ||
| 29 | + it('supports absolute paths', async () => { | ||
| 30 | + const code = ` | ||
| 31 | + require('assert').strictEqual(process.env.BASIC, 'basic'); | ||
| 32 | + `.trim(); | ||
| 33 | + const child = await common.spawnPromisified( | ||
| 34 | + process.execPath, | ||
| 35 | + [ `--env-file=${path.resolve(__dirname, validEnvFilePath)}`, '--eval', code ], | ||
| 36 | + ); | ||
| 37 | + assert.strictEqual(child.stderr, ''); | ||
| 38 | + assert.strictEqual(child.code, 0); | ||
| 39 | + }); | ||
| 40 | + | ||
| 28 | 41 | it('should handle non-existent .env file', async () => { | |
| 29 | 42 | const code = ` | |
| 30 | 43 | require('assert').strictEqual(1, 1) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments