`mvnw.flags()` unexpectedly terminates process for unavailable parser version
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 90/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- cli
Research direction
Start in src/mvnw.js at the parser-version availability check and review the existing direct uses of flags(). Add or update the regression coverage in test/test_mvnw.js using an unavailable parser version. Done means flags() exposes a catchable Error while the CLI still reports the failure and exits non-zero through src/eoc.js.
Written by the indexing model from the issue text.
Description
What happens
src/mvnw.js exports flags(opts), but an unavailable parser version does not fail by throwing an error. It calls process.exit(1) from inside that reusable helper:
if (opts.parser && !opts.parser.endsWith('-SNAPSHOT') && !parserVersion.exists(opts.parser)) {
console.error(...);
process.exit(1);
}
Verified on current master 66bdfe88da4faa74a088c743c9611441edbe7e73 in an isolated Node process by stubbing only the Maven-Central lookup:
const parser = require('./src/parser-version');
parser.exists = () => false;
const {flags} = require('./src/mvnw');
try {
flags({sources: 'src', target: 'target', parser: '9.9.9'});
} catch (err) {
console.log('THREW', err.message);
}
console.log('SURVIVED_AFTER_FLAGS');
Actual result:
Sources in src
Target in target
Parser version 9.9.9 is not available in Maven Central.
Please check available versions at: https://repo.maven.apache.org/maven2/org/eolang/eo-maven-plugin/
Or use --latest flag to get the most recent version.
node_exit=1
Neither THREW nor SURVIVED_AFTER_FLAGS is printed: flags() terminates the hosting process from inside the helper.
Why it is wrong
flags() is exported and used as an ordinary value-producing function throughout the command modules and directly in test/test_mvnw.js. A caller cannot catch this failure, wrap it with context, clean up resources, or use EOC as a library without risking an unexpected process termination.
The top-level CLI already has a single error boundary in src/eoc.js around program.parseAsync(...); an exception from flags() would naturally reach that boundary and still make the CLI exit non-zero, without forcing every library caller to die.
This is also inconsistent with newer EOC helpers such as JDK validation, which throw Error objects so callers can handle or wrap them.
What should happen
The helper should throw an Error carrying the existing diagnostic instead of calling process.exit(1). The CLI will still report the message and exit non-zero at its top-level error handler, while direct/library callers can catch the failure.
A regression test should call flags() with a stubbed unavailable version and assert that it throws rather than terminating the test process.
I searched this repository's issues for flags process.exit, mvnw flags exits process, invalid parser kills process, library process exit parser version, and related wording and found no duplicate.
- Dominant language
- JavaScript
- Stars
- 36
- Forks
- 64
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 17
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from objectionary/eoc
-
bug good-title
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
objectionary/eoc#1360 ·
-
bug good-title
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
objectionary/eoc#1359 ·
-
bug good-title
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
objectionary/eoc#1358 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
objectionary/eoc#1357 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
objectionary/eoc#1356 ·
All issues in objectionary/eoc
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·