1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-29 13:41:00 +01:00

Show which PID is causing a temp root

Example:

  error: Cannot delete path '/nix/store/klyng5rpdkwi5kbxkncy4gjwb490dlhb-foo.drv' because it's in use by Nix process '{nix-process:3605324}'.
This commit is contained in:
Eelco Dolstra 2025-06-27 16:50:48 +02:00
parent cae732f7a1
commit 31b00218fe
6 changed files with 35 additions and 20 deletions

View file

@ -21,11 +21,16 @@ nix-env -p "$profiles/test" -f ./gc-runtime.nix -i gc-runtime
outPath=$(nix-env -p "$profiles/test" -q --no-name --out-path gc-runtime)
echo "$outPath"
fifo="$TEST_ROOT/fifo"
mkfifo "$fifo"
echo "backgrounding program..."
"$profiles"/test/program &
sleep 2 # hack - wait for the program to get started
"$profiles"/test/program "$fifo" &
child=$!
echo PID=$child
cat "$fifo"
expectStderr 1 nix-store --delete "$outPath" | grepQuiet "Cannot delete path.*because it's referenced by the GC root '/proc/"
nix-env -p "$profiles/test" -e gc-runtime
nix-env -p "$profiles/test" --delete-generations old