nixos-rebuild: Fix "too long for Unix domain socket" errors due to long
TMPDIR
This commit is contained in:
parent
d6c182f2ae
commit
3dbf54decb
1 changed files with 7 additions and 0 deletions
|
@ -407,6 +407,13 @@ fi
|
||||||
|
|
||||||
tmpDir=$(mktemp -t -d nixos-rebuild.XXXXXX)
|
tmpDir=$(mktemp -t -d nixos-rebuild.XXXXXX)
|
||||||
|
|
||||||
|
if [[ ${#tmpDir} -ge 60 ]]; then
|
||||||
|
# Very long tmp dirs lead to "too long for Unix domain socket"
|
||||||
|
# SSH ControlPath errors. Especially macOS sets long TMPDIR paths.
|
||||||
|
rmdir "$tmpDir"
|
||||||
|
tmpDir=$(TMPDIR= mktemp -t -d nixos-rebuild.XXXXXX)
|
||||||
|
fi
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
for ctrl in "$tmpDir"/ssh-*; do
|
for ctrl in "$tmpDir"/ssh-*; do
|
||||||
ssh -o ControlPath="$ctrl" -O exit dummyhost 2>/dev/null || true
|
ssh -o ControlPath="$ctrl" -O exit dummyhost 2>/dev/null || true
|
||||||
|
|
Loading…
Reference in a new issue