Skip to content

Conversation

@adamchalmers
Copy link
Collaborator

System ruby probably shouldn't be trusted,
this is rv after all, we should use rv ruby.

System ruby probably shouldn't be trusted,
this is rv after all, we should use rv ruby.
Copy link
Member

@indirect indirect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks reasonable to me... maybe later we can invoke run directly rather than shelling out?

Copy link
Contributor

@kaspth kaspth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I had a few questions, but feel free to skip if they're getting in the way.

Comment on lines 678 to 686
let mut child = std::process::Command::new("rv")
.args([
"ruby",
"run",
&ruby_version.to_string(),
"--",
"-e",
"Gem.load_yaml; print Gem::SafeYAML.safe_load(ARGF.read).to_ruby",
])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a Rust question since I'm new: would it make sense to extract a Runner struct that we inject the ruby_version into and then do this?

pub fn run(&self, args) {
  std::process::Command::new("rv").args(["ruby", "run", &self.ruby_version.to_string(), "--", ..args]).output()
}

then we can pass the runner around instead of the plain ruby_version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either one would work, but what is the advantage of doing your proposal?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK actually yeah, I like this, because otherwise we have to thread the config many function calls deep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants