Open thewh1teagle opened 1 week ago
1.1.6+e58d67b46
Windows / macOS
Create two files:
hello
#!/bin/bash echo "Hello"
main.js
import { $ } from 'bun' process.env.PATH = `${__dirname}:${process.env.PATH}` console.log(process.env.PATH.split(':')[0]) await $`hello`
Add permission to hello
chmod +x hello
Run main.js
bun run main.js # Command not found error
Run again and see that it works with correct path
PATH=$(pwd):$PATH bun run main.js
When modifying process.env.PATH it should run binaries / scripts which are in the PATH.
Error, it doesn't find those scripts / binaries
➜ bun-issue pwd /Users/user/Documents/bun-issue ➜ bun-issue cat hello #!/bin/bash echo "Hello"% ➜ bun-issue cat main.js import { $ } from 'bun' process.env.PATH = `${__dirname}:${process.env.PATH}` console.log(process.env.PATH.split(':')[0]) await $`hello` ➜ bun-issue bun run main.js /Users/user/Documents/bun-issue bun: command not found: hello 1 | import { $ } from 'bun' 2 | process.env.PATH = `${__dirname}:${process.env.PATH}` 3 | console.log(process.env.PATH.split(':')[0]) 4 | await $`hello` ^ ShellError: Failed with exit code 1 info: { "exitCode": 1, "stderr": "bun: command not found: hello\n", "stdout": "" } at new ShellError (:12:31) at new ShellPromise (:64:31) at BunShell (:184:69) at /Users/user/Documents/bun-issue/main.js:4:7 ➜ bun-issue PATH=$(pwd):$PATH bun run main.js /Users/user/Documents/bun-issue Hello
What version of Bun is running?
1.1.6+e58d67b46
What platform is your computer?
Windows / macOS
What steps can reproduce the bug?
Create two files:
hello
main.js
Add permission to hello
Run
main.js
Run again and see that it works with correct path
What is the expected behavior?
When modifying process.env.PATH it should run binaries / scripts which are in the PATH.
What do you see instead?
Error, it doesn't find those scripts / binaries
Additional information