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

bun run doesn't parse string arguments correctly #14562

Closed
Kostas-Xafis opened this issue Oct 14, 2024 · 1 comment
Closed

bun run doesn't parse string arguments correctly #14562

Kostas-Xafis opened this issue Oct 14, 2024 · 1 comment
Labels
bug Something isn't working cli Something to do with CLI arguments

Comments

@Kostas-Xafis
Copy link

Kostas-Xafis commented Oct 14, 2024

What version of Bun is running?

1.1.29+6d43b3662

What platform is your computer?

Linux 6.5.0-44-generic x86_64 x86_64

What steps can reproduce the bug?

I have a script named query that executes this: bun --env-file=".env.development" getData/query.ts.

Now to pass any arguments to the script I would use it like: bun run query --prod --q "SELECT * from table" .

But running it normally like: bun --env-file='.env.development' getData/query.ts --prod --q "SELECT * from table" doesn't have any problems running and parsing the arguments, like the case above.

I tried to escape both " and ' but nothing worked.

Unless this is 1-to-1 behaviour with how npm loads argruments to scripts, then I am pretty sure that this is a bug.

What is the expected behavior?

Expected behaviour should be that the bun run command would parse a string argument, like in the example above correctly, as 1 argument. Like:

argv = [ "/home/user/.bun/bin/bun", "/home/user/project/getData/query.ts",
  "--prod", "--q", "SELECT * FROM table"
]

What do you see instead?

What I get instead is:

argv = [
  "/home/user/.bun/bin/bun", "/home/user/project/getData/query.ts",
  "--prod", "--q", "SELECT", "astro.config.mjs", "bucket", "bunfig.toml", "bun.lockb", "dbSnapshots",
  "dist", "email", "getData", "imageCompression", "lib", "node_modules", "notAssets", "notes.txt",
  "package.json", "pdfWorker", "public", "replicaDbSync.txt", "schema.sql", "src", "tailwind.config.cjs",
  "tests", "test.ts", "tsconfig.json", "types", "wrangler.toml", "FROM", "table"
]

Additional information

Importing argv through either process or bun result to the same problem.

@Kostas-Xafis Kostas-Xafis added bug Something isn't working needs triage labels Oct 14, 2024
@nektro nektro added cli Something to do with CLI arguments and removed needs triage labels Oct 14, 2024
@pfgithub
Copy link
Contributor

Should be fixed by #14884

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli Something to do with CLI arguments
Projects
None yet
Development

No branches or pull requests

3 participants