Skip to content

Commit 23bc674

Browse files
committed
src: make dotenv return warning when not found
1 parent 8e9686d commit 23bc674

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/node.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ static ExitCode InitializeNodeWithArgsInternal(
845845
errors->push_back(file_path + ": invalid format");
846846
break;
847847
case Dotenv::ParseResult::FileError:
848-
errors->push_back(file_path + ": not found");
848+
fprintf(stderr, "Warning: Requested .env file not found\n\n");
849849
break;
850850
default:
851851
UNREACHABLE();

test/parallel/test-dotenv-edge-cases.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ describe('.env supports edge cases', () => {
4848
[ '--env-file=.env', '--eval', code ],
4949
{ cwd: __dirname },
5050
);
51-
assert.notStrictEqual(child.stderr.toString(), '');
52-
assert.strictEqual(child.code, 9);
51+
assert.ok(child.stderr.includes('Requested .env file not found'));
52+
assert.strictEqual(child.code, 0);
5353
});
5454

5555
it('should not override existing environment variables but introduce new vars', async () => {

0 commit comments

Comments
 (0)