denoland / std

The Deno Standard Library
https://jsr.io/@std
MIT License
3.21k stars 621 forks source link

[@std/dotenv] can't handle multi line variable #6170

Open ryanhex53 opened 2 weeks ago

ryanhex53 commented 2 weeks ago

Describe the bug

the @std/dotenv library can't handle multi line variable correctly, it only return the first line of the string.

Steps to Reproduce

.env

KEY="one line string
second line string"

main.ts

import { load } from "@std/dotenv";
await load({ export: true });
console.log(Deno.env.get("KEY"));

deno run -A main.ts get output one line string

But if don't use @std/dotenv, only deno run -A --env-file main.ts main.ts

console.log(Deno.env.get("KEY"));

will get correct output one line string\nsecond line string

Expected behavior

get multiline output one line string\nsecond line string while use @std/dotenv

Environment