forked from lix-project/lix
find-runtime-roots.pl: Search process environments for roots
For instance, this prevents paths from being deleted that are in use by a "nix-build --run-env" session.
This commit is contained in:
parent
938092a213
commit
00f698eb8b
|
@ -35,6 +35,13 @@ sub readProc {
|
||||||
}
|
}
|
||||||
close MAP;
|
close MAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Get all store paths that appear in the environment of this process.
|
||||||
|
eval {
|
||||||
|
my $env = Nix::Utils::readFile "$process/environ";
|
||||||
|
my @matches = $env =~ /\/nix\/store\/[0-9a-z]+[0-9a-zA-Z\+\-\._\?=]*/g;
|
||||||
|
print "$_\n" foreach @matches;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir DIR;
|
closedir DIR;
|
||||||
|
|
Loading…
Reference in a new issue