downloadFile(): print command in the error message

so people can figure out that they don't have "curl" installed
This commit is contained in:
Ștefan Talpalaru 2019-04-01 20:41:35 +02:00
parent d3f13d01e7
commit f6eb6af310
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
1 changed files with 3 additions and 2 deletions

View File

@ -39,9 +39,10 @@ template `//`(url, fragment: string): string =
url & "/" & fragment
proc downloadFile(url: string): Future[string] {.async.} =
let (fileContents, errorCode) = execCmdEx("curl --fail " & url, options = {poUsePath})
let cmd = "curl --fail " & url
let (fileContents, errorCode) = execCmdEx(cmd, options = {poUsePath})
if errorCode != 0:
raise newException(IOError, "Failed to download URL: " & url & "\n" & fileContents)
raise newException(IOError, "Failed external command: '" & cmd & "', exit code: " & $errorCode & ", output: '" & fileContents & "'")
return fileContents
proc updateTestnetMetadata(conf: BeaconNodeConf): Future[NetworkMetadata] {.async.} =