Fix #163 - retries for network calls
This commit is contained in:
parent
f71cf837d2
commit
a06081f807
1 changed files with 4 additions and 4 deletions
|
|
@ -231,12 +231,12 @@ proc downloadUrl*(url, outdir: string) =
|
||||||
else:
|
else:
|
||||||
cmd = findExe("wget")
|
cmd = findExe("wget")
|
||||||
if cmd.len != 0:
|
if cmd.len != 0:
|
||||||
cmd &= " $# -o $#"
|
cmd &= " $# -O $#"
|
||||||
elif defined(Windows):
|
elif defined(Windows):
|
||||||
cmd = "powershell [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; wget $# -OutFile $#"
|
cmd = "powershell [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; wget $# -OutFile $#"
|
||||||
else:
|
else:
|
||||||
doAssert false, "No download tool available - curl, wget"
|
doAssert false, "No download tool available - curl, wget"
|
||||||
discard execAction(cmd % [url, (outdir/file).sanitizePath])
|
discard execAction(cmd % [url, (outdir/file).sanitizePath], retry = 1)
|
||||||
|
|
||||||
if ext == ".zip":
|
if ext == ".zip":
|
||||||
extractZip(file, outdir)
|
extractZip(file, outdir)
|
||||||
|
|
@ -299,11 +299,11 @@ proc gitPull*(url: string, outdir = "", plist = "", checkout = "") =
|
||||||
|
|
||||||
if checkout.len != 0:
|
if checkout.len != 0:
|
||||||
echo "# Checking out " & checkout
|
echo "# Checking out " & checkout
|
||||||
discard execAction(&"cd {outdirQ} && git fetch")
|
discard execAction(&"cd {outdirQ} && git fetch", retry = 1)
|
||||||
discard execAction(&"cd {outdirQ} && git checkout {checkout}")
|
discard execAction(&"cd {outdirQ} && git checkout {checkout}")
|
||||||
else:
|
else:
|
||||||
echo "# Pulling repository"
|
echo "# Pulling repository"
|
||||||
discard execAction(&"cd {outdirQ} && git pull --depth=1 origin master")
|
discard execAction(&"cd {outdirQ} && git pull --depth=1 origin master", retry = 1)
|
||||||
|
|
||||||
proc findFile*(file: string, dir: string, recurse = true, first = false, regex = false): string =
|
proc findFile*(file: string, dir: string, recurse = true, first = false, regex = false): string =
|
||||||
## Find the file in the specified directory
|
## Find the file in the specified directory
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue