Skip to content

fix(sdk): honor pinned JDK in run + accept distribution+major args#39

Merged
ch99q merged 1 commit into
mainfrom
ch99q/sdk-use-ignored-in-run
May 12, 2026
Merged

fix(sdk): honor pinned JDK in run + accept distribution+major args#39
ch99q merged 1 commit into
mainfrom
ch99q/sdk-use-ignored-in-run

Conversation

@ch99q
Copy link
Copy Markdown
Collaborator

@ch99q ch99q commented May 12, 2026

Summary

  • pluggy sdk use|path|remove now accept <distribution> <major> as well as <major>, matching how sdk list formats entries (temurin 17). --distribution still works; conflicts between the positional and the option throw InvalidArgumentError.
  • pluggy run <script> now prepends the project's cached, pinned JDK to PATH and sets JAVA_HOME for the spawned child, so scripts see the same Java as build / dev. Cache-only — running a script never triggers a JDK download.
  • Top-level error handler in src/index.ts no longer swallows InvalidArgumentError thrown from action bodies (commander never prints those), and now actually exits 2 for InvalidArgumentError / UserError as the existing fallback intended (commander hardcodes exitCode=1, which short-circuited the fallback).

Test plan

  • vp check
  • vp test (658 passed, 4 skipped, unchanged)
  • Manual via playground/:
    • pluggy sdk use temurin 17, pluggy sdk use 21, and --distribution conflict path
    • pluggy run fish (script java --version) with jdk.major: 17 pinned → resolves Temurin 17, not system OpenJDK 25
    • pluggy sdk use abc now prints the error (was silent) and exits 2

`pluggy sdk use temurin 17` now works as a two-token form matching how
`sdk list` displays JDKs. Same on `sdk path` and `sdk remove`.

`pluggy run <script>` now prepends the project's pinned JDK to PATH and
sets JAVA_HOME on the spawned child, so scripts see the same Java as
`pluggy build` / `pluggy dev`. Cache-only by design: a script that
doesn't use Java shouldn't trigger a JDK download.

Top-level error handler now lets action-thrown InvalidArgumentError
reach emitError (was silently swallowed alongside commander's
already-printed parse-time errors), and exits 2 for InvalidArgumentError
/ UserError as the existing fallback intended (commander hardcodes
exitCode=1 on InvalidArgumentError, which short-circuited the fallback).
@ch99q ch99q merged commit 263c505 into main May 12, 2026
4 checks passed
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.

1 participant