You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am wondering if there is a specific reason why devbox run overwrites the present working directory (PWD) to the project root instead of respecting the current working directory.
Current behavior:
$ cd project
$ pwd
/user/project
$ cd subdir
$ pwd
/user/project/subdir
$ devbox run -- pwd
/user/project
Expected behavior (last command executed from the current directory):
$ devbox run -- pwd
/user/project/subdir
The text was updated successfully, but these errors were encountered:
I think it's because if you have scripts defined in devbox.json (which are executed by devbox run), you would want them to always run from the same directory.
But when you're using devbox run to run a command rather than a script, I agree it would be better to respect the current working directory.
Hey @alezkv when you run any devbox command including devbox run we always search for the first devbox.json we see going from the current directory up. Once we locate the devbox.json then the commands are run from the perspective of the json file. I agree that in your example it is a bit confusing to see pwd printing the location to the devbox.json rather than where the command is being run from. But overall, this approach helps having a consistent behavior among the 2 methods you can use devbox run :
It appears that neither of these cases provides a proper way to execute a command within a subdirectory. With both approaches, I have to wrap the command with cd to meet my needs.
It would be great to see a hint for that behavior somewhere in the --help section.
I am wondering if there is a specific reason why
devbox run
overwrites the present working directory (PWD) to the project root instead of respecting the current working directory.Current behavior:
Expected behavior (last command executed from the current directory):
$ devbox run -- pwd /user/project/subdir
The text was updated successfully, but these errors were encountered: