Add a script for testing curl | zsh resilience and mention it in the README

This commit is contained in:
Danielle McLean 2016-10-04 23:38:41 +11:00
parent a324ca62c8
commit 5178802725
No known key found for this signature in database
GPG key ID: CC91589719027E94
3 changed files with 30 additions and 2 deletions

12
_scripts/partial-dl-test Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env zsh
actualSize=$(wc -c < $1)
for (( size = 0; size < actualSize; size++ )); do
head -c$size $1 | env -i HOME=$HOME/test zsh 2>/dev/null
if [[ -d $HOME/test ]]; then
percent=$(( size * 100 / actualSize ))
echo "dots still ran with only $size bytes available, " \
"$percent% of its full $actualSize bytes!" 2>/dev/null
exit $size
fi
done