Commit b0f6d2e
Cache Java version to avoid redundant subprocess call
The check and message functions were both calling getJavaVersion(),
spawning the subprocess twice. This created inefficiency and a TOCTOU
risk where the Java environment could change between calls.
Now check caches the detected version in context.props.javaVersion,
and message reads from the cache. The message function is now
synchronous since it only reads from context.
The InstallPreReq.message type was updated to allow both sync and
async functions for flexibility.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 45bfed9 commit b0f6d2e
2 files changed
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
43 | | - | |
44 | | - | |
| 44 | + | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
0 commit comments