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

Handle exec error #722

Merged
merged 2 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions common.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,11 @@ export function setupPath(newPathEntries) {
return msys2Type
}

export async function setupJavaHome() {
export async function setupJavaHome(rubyPrefix) {
await measure("Modifying JAVA_HOME for JRuby", async () => {
console.log("attempting to run with existing JAVA_HOME")

let ret = await exec.exec('ruby', ['--version'])
let ret = await exec.exec('java', ['-jar', path.join(rubyPrefix, 'lib/jruby.jar'), '--version'], {ignoreReturnCode: true})
Copy link
Member

Choose a reason for hiding this comment

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

This should be $JAVA_HOME/bin/java (or process.env, you get the idea) as java in PATH might resolve to something different and in fact it does I saw /usr/bin/java in logs. Could you make a PR to address that?

Copy link
Member

Choose a reason for hiding this comment

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


if (ret === 0) {
console.log("JRuby successfully starts, using existing JAVA_HOME")
Expand Down
6 changes: 3 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ruby-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export async function install(platform, engine, version) {

// Ensure JRuby has minimum Java version to run
if (engine === "jruby") {
await common.setupJavaHome()
await common.setupJavaHome(rubyPrefix)
}

return rubyPrefix
Expand Down
Loading