Failed Process Running a Binary File (solidity compiler)

Hello,

I’m trying to build a version management tool for the solidity compiler solc in Julia, and, while the process seems to work properly, I’ve got a curious warning message at then end of the process.
Here a MWE:

using HTTP

filename = "solc-macosx-amd64-v0.8.9+commit.e5eed63a"
OS = "macosx"

url = string("https://solc-bin.ethereum.org/",OS,"-amd64/",filename)

r = HTTP.request("GET", url)
HTTP.download(url, "test/")

run(`chmod a+x $(string("test/",filename))`)

cd("test")

run(`./$filename`);

And the error message is:

ERROR: LoadError: failed process: Process(`./solc-macosx-amd64-v0.8.9+commit.e5eed63a`, ProcessExited(1)) [1]

I can’t figure out what does it means, knowing that the solidity compiler is successfully built from source based on this code.

Anyone has an idea of the source of this error and what am I doing wrong?

Best regards,

Thomas

What is not clear? The process failed because it returned exit code 1. You can see a similar example with

julia> run(`false`)
ERROR: failed process: Process(`false`, ProcessExited(1)) [1]

Maybe you need to provide extra arguments?

Side note, to download files you don’t need HTTP.jl, the Downloads standard library works just fine:

using Downloads

filename = "solc-macosx-amd64-v0.8.9+commit.e5eed63a"
OS = "macosx"

url = string("https://solc-bin.ethereum.org/",OS,"-amd64/",filename)
path = Downloads.download(url, joinpath(tempdir(), filename))

run(`chmod a+x $(path)`)
run(`$(path)`)
1 Like

Hello,

Thank you for your answer.

Indeed, it was unclear to me just because of my misunderstanding of the process (I was trying to translate a function from a Python package). I should use extra argument as you mentioned, in order to indicate to the ‘solc’ compiler what command should it run.

Thanks for your precision for the download function.

Best regards,

Thomas