diff --git a/tests/tools/cirdl/testcirdl.nim b/tests/tools/cirdl/testcirdl.nim index 2b478f2e..5c9fcb85 100644 --- a/tests/tools/cirdl/testcirdl.nim +++ b/tests/tools/cirdl/testcirdl.nim @@ -7,12 +7,12 @@ import ../../integration/marketplacesuite marketplacesuite "tools/cirdl": const - cirdl = "tools/cirdl/cirdl" + cirdl = "build" / "cirdl" workdir = "." test "circuit download tool": let - circuitPath = "testcircuitpath" + circuitPath = "." / "testcircuitpath" rpcEndpoint = "ws://localhost:8545" marketplaceAddress = $marketplace.address @@ -21,7 +21,8 @@ marketplacesuite "tools/cirdl": let process = osproc.startProcess( cirdl, workdir, - args + args, + options={poParentStreams} ) let returnCode = process.waitForExit() diff --git a/tools/cirdl/cirdl.nim b/tools/cirdl/cirdl.nim index 93485411..d7f0e896 100644 --- a/tools/cirdl/cirdl.nim +++ b/tools/cirdl/cirdl.nim @@ -5,7 +5,7 @@ import pkg/chronos import pkg/ethers import pkg/questionable import pkg/questionable/results -# import pkg/zippy/ziparchives +import pkg/zippy/ziparchives import pkg/chronos/apps/http/httpclient import ../../codex/contracts/marketplace @@ -60,10 +60,10 @@ proc downloadZipfile(url: string, filepath: string): Future[?!void] {.async.} = success() proc unzip(zipfile:string, targetPath: string): ?!void = - # try: - # extractAll(zipfile, targetPath) - # except Exception as exc: - # return failure(exc.msg) + try: + extractAll(zipfile, targetPath) + except Exception as exc: + return failure(exc.msg) success() proc main() {.async.} = @@ -77,11 +77,13 @@ proc main() {.async.} = circuitPath = args[0] rpcEndpoint = args[1] marketplaceAddress = args[2] - zipfile = circuitPath / "circuit.zip" + zipfile = "circuit.zip" debug "Starting", circuitPath, rpcEndpoint, marketplaceAddress - discard existsOrCreateDir(circuitPath) + if (dirExists(circuitPath)): + info "Removing previous circuit path" + removeDir(circuitPath) without circuitHash =? (await getCircuitHash(rpcEndpoint, marketplaceAddress)), err: error "Failed to get circuit hash", msg = err.msg