Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cargo-binstall to be compatible with JRuby #26

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions cargo-binstall/cargo-binstall
Original file line number Diff line number Diff line change
Expand Up @@ -79,25 +79,17 @@ def download_and_save(triple)
system("unzip -p #{zipfile} #{filename} > #{outfile}")
FileUtils.rm(zipfile)
elsif ext == "tgz"
content = pipe_command("tar xzf - -O", stdin: response.body)
File.binwrite(outfile, content)
zipfile = File.join(tmpdir, 'cargo-binstall.tgz')
File.binwrite(zipfile, response.body)
system("tar xzf #{zipfile} -O > #{outfile}")
FileUtils.rm(zipfile)
end

ret = outfile
File.chmod(0o755, ret)
ret
end

def pipe_command(cmd, stdin:)
require "open3"

stdout_and_stderr_str, status = Open3.capture2e(cmd, stdin_data: stdin)

abort(stdout_and_stderr_str) unless status.success?

stdout_and_stderr_str
end

def install_cargo_binstall
puts("::group::Installing cargo-binstall")
target_triple = infer_target_triple
Expand Down