Skip to content

Commit 3224696

Browse files
committed
Handle exec error
Apparently this exec errors when the subprocess fails rather than returning an error code. This causes the whole setup process to terminate. This patch catches the error and uses that to indicate failure to launch.
1 parent f0a4d6b commit 3224696

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

common.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,15 @@ export async function setupJavaHome() {
409409
await measure("Modifying JAVA_HOME for JRuby", async () => {
410410
console.log("attempting to run with existing JAVA_HOME")
411411

412-
let ret = await exec.exec('ruby', ['--version'])
412+
let success = true
413413

414-
if (ret === 0) {
414+
try {
415+
await exec.exec('ruby', ['--version'])
416+
} catch (e) {
417+
success = false
418+
}
419+
420+
if (success) {
415421
console.log("JRuby successfully starts, using existing JAVA_HOME")
416422
} else {
417423
console.log("JRuby failed to start, try Java 21 envs")

dist/index.js

+8-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)