bun icon indicating copy to clipboard operation
bun copied to clipboard

bun --eval ignores first command line arg

Open cjmalloy opened this issue 7 months ago • 1 comments

What version of Bun is running?

1.1.17+bb66bba1b

What platform is your computer?

Linux 5.4.0-186-generic x86_64 x86_64

What steps can reproduce the bug?

chris@eggnog:~$ bun -e "console.log(process.argv)" 1 2 3
[ "/home/chris/.bun/bin/bun", "/home/chris/[eval]", "2", "3" ]
chris@eggnog:~$ node -e "console.log(process.argv)" 1 2 3
[ '/home/chris/.nvm/versions/node/v20.14.0/bin/node', '1', '2', '3' ]
chris@eggnog:~$ bun --version
1.1.17

What is the expected behavior?

Should match node and not ignore the first argument.

What do you see instead?

First argument missing.

Additional information

Similarly for bun --print.

My workaround is to just include a placeholder arg and modify argv:

chris@eggnog:~$ bun -e "process.argv.splice(1, 1); console.log(process.argv)" skip 1 2 3
[ "/home/chris/.bun/bin/bun", "1", "2", "3" ]
chris@eggnog:~$ node -e "process.argv.splice(1, 1); console.log(process.argv)" skip 1 2 3
[ '/home/chris/.nvm/versions/node/v20.14.0/bin/node', '1', '2', '3' ]

cjmalloy avatar Jun 27 '24 17:06 cjmalloy