mirror of
https://github.com/whyour/qinglong.git
synced 2026-02-12 14:05:38 +08:00
Preserve original TMPDIR value when setting temporary directory
Improve git_clone_scripts to save and restore the original TMPDIR value instead of unconditionally unsetting it, avoiding unintended side effects. Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
parent
7deab5d18e
commit
60f8286825
|
|
@ -259,10 +259,15 @@ git_clone_scripts() {
|
||||||
set_proxy "$proxy"
|
set_proxy "$proxy"
|
||||||
|
|
||||||
# Set TMPDIR to /tmp to avoid "unable to get random bytes" error in some Docker environments
|
# Set TMPDIR to /tmp to avoid "unable to get random bytes" error in some Docker environments
|
||||||
|
local original_tmpdir="${TMPDIR:-}"
|
||||||
export TMPDIR=/tmp
|
export TMPDIR=/tmp
|
||||||
git clone -q --depth=1 $part_cmd $url $dir
|
git clone -q --depth=1 $part_cmd $url $dir
|
||||||
exit_status=$?
|
exit_status=$?
|
||||||
unset TMPDIR
|
if [[ -n "$original_tmpdir" ]]; then
|
||||||
|
export TMPDIR="$original_tmpdir"
|
||||||
|
else
|
||||||
|
unset TMPDIR
|
||||||
|
fi
|
||||||
|
|
||||||
unset_proxy
|
unset_proxy
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user