devbox icon indicating copy to clipboard operation
devbox copied to clipboard

nested shells make it harder to debug issues; document workarounds for better local dev

Open jay-aye-see-kay opened this issue 3 months ago • 0 comments

What problem are you trying to solve?

When debugging devbox (and trying to submit a fix) many commands spawn a nested devbox subprocess with the --run-in-current-shell flag. The current process doesn't really do any work, just spawns the subprocess. This means adding debug logs and running devbox services up won't emit any - all the interesting stuff will happen in the subprocess, which is the installed version of devbox.

I have a couple workarounds but I feel this should be documented in the repo

What solution would you like?

The most robust fix I've found is instead of doing devbox run build && ./dist/devbox <whatever> (what I would expect to work)

  1. build and move it
    devbox run build
    mkdir -p ~/.cache/devbox/bin/0.0.0-dev_darwin_arm64/
    mv dist/devbox ~/.cache/devbox/bin/0.0.0-dev_darwin_arm64/
    
  2. then in any shell, any directory
    export DEVBOX_USE_VERSION=0.0.0-dev
    devbox <whatever>
    

Alternatives you've considered

An alternative fix is to pass the --run-in-current-shell flag, but this behavior will slightly differ from a real devbox build, meaning some issues can't be reproduced (in my current case).

./dist/devbox <whatever> --run-in-current-shell

jay-aye-see-kay avatar Sep 16 '25 05:09 jay-aye-see-kay