mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
Merge pull request #150065 from thiagokokada/workaround-issue-144811
nixos-rebuild: switch to tmpDir during rebuilds
This commit is contained in:
commit
d95c81133f
1 changed files with 3 additions and 1 deletions
|
@ -362,14 +362,16 @@ if [ "$action" = edit ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
ORIGIN_PWD="$PWD"
|
||||
tmpDir=$(mktemp -t -d nixos-rebuild.XXXXXX)
|
||||
SSHOPTS="$NIX_SSHOPTS -o ControlMaster=auto -o ControlPath=$tmpDir/ssh-%n -o ControlPersist=60"
|
||||
cd "$tmpDir"
|
||||
|
||||
cleanup() {
|
||||
for ctrl in "$tmpDir"/ssh-*; do
|
||||
ssh -o ControlPath="$ctrl" -O exit dummyhost 2>/dev/null || true
|
||||
done
|
||||
cd "$ORIGIN_PWD"
|
||||
rm -rf "$tmpDir"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
|
Loading…
Reference in a new issue