We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ce2f681 commit 449afbcCopy full SHA for 449afbc
src/scripts/unix.sh
@@ -84,12 +84,19 @@ get() {
84
if [ "$mode" = "-s" ]; then
85
sudo curl "${curl_opts[@]}" "${links[0]}"
86
else
87
+ lock_path="$file_path.lock"
88
+ until sudo mkdir "$lock_path" 2>/dev/null; do
89
+ echo "Another process is downloading a file at $file_path, waiting"
90
+ sleep 1
91
+ done
92
+ trap 'sudo rm -rf "$lock_path"' EXIT SIGINT SIGTERM
93
for link in "${links[@]}"; do
94
status_code=$(sudo curl -w "%{http_code}" -o "$file_path" "${curl_opts[@]}" "$link")
95
[ "$status_code" = "200" ] && break
96
done
97
[ "$execute" = "-e" ] && sudo chmod a+x "$file_path"
98
[ "$mode" = "-v" ] && echo "$status_code"
99
+ sudo rm -rf "$lock_path" >/dev/null 2>&1 || true
100
fi
101
}
102
0 commit comments