Skip to content

Commit c70d88b

Browse files
hsbtclaude
authored andcommitted
[ruby/rubygems] Use JSON for cargo metadata parsing
ruby/rubygems@d18e420215 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent bab8120 commit c70d88b

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

lib/rubygems/ext/cargo_builder.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,9 @@ def cargo_crate_name(cargo_dir, manifest_path, results)
227227
raise Gem::InstallError, "cargo metadata failed#{exit_reason}"
228228
end
229229

230-
# cargo metadata output is specified as json, but with the
231-
# --format-version 1 option the output is compatible with YAML, so we can
232-
# avoid the json dependency
233-
metadata = Gem::SafeYAML.safe_load(output)
230+
# cargo metadata output is specified as json
231+
require "json"
232+
metadata = JSON.parse(output)
234233
package = metadata["packages"].find {|pkg| normalize_path(pkg["manifest_path"]) == manifest_path }
235234
unless package
236235
found = metadata["packages"].map {|md| "#{md["name"]} at #{md["manifest_path"]}" }

0 commit comments

Comments
 (0)