Test hangs when run inside the sandbox

I have problem with running the tests of a Rust application in the Nix sandbox. When the tests are executed interactively, they all pass, but when they are run as part of the build inside the Nix sandbox, two of the tests hang indefinitely and I have no idea why.

This is the application in question: git clone https://github.com/hmenke/git-branchless

  1. Works fine: nix develop -c bash -c 'PATH_TO_GIT=$(type -fP git) GIT_EXEC_PATH=$(git --exec-path) cargo test'

  2. Hangs permanently: nix build -L

So far I was unable to reproduce the deadlock outside of the Nix sandbox.