Repository navigation
fix(doctor): handle wildcard android runtime version without crashing #6245
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,10 +38,8 @@ export class AndroidToolsInfo implements NativeScriptDoctor.IAndroidToolsInfo { | |
| ]; | ||
|
|
||
| const isRuntimeVersionLessThan = (targetVersion: string) => { | ||
| return ( | ||
| runtimeVersion && | ||
| semver.lt(semver.coerce(runtimeVersion), targetVersion) | ||
| ); | ||
| const coercedVersion = semver.coerce(runtimeVersion); | ||
| return coercedVersion && semver.lt(coercedVersion, targetVersion); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Legacy When Before this change, the same input made Resolve the installed
|
||
| }; | ||
|
|
||
| if (isRuntimeVersionLessThan("6.1.0")) { | ||
|
|
@@ -225,6 +223,7 @@ export class AndroidToolsInfo implements NativeScriptDoctor.IAndroidToolsInfo { | |
|
|
||
| if ( | ||
| runtimeMinVersion && | ||
| semver.valid(runtimeVersion) && | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check compatibility for valid runtime ranges. With Java 10 and runtime
|
||
| semver.lt(runtimeVersion, runtimeMinVersion) | ||
| ) { | ||
| warning = | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A failed doctor check can exit with status 0.
When
getInfosfails, the spinner returnsnull. The new guard atlib/services/doctor-service.ts:102-104returns fromprintWarningswithout an error. The command then resolves, so the error handler inbeginCommandnever sets a failure exit code. Before this change, theinfos.filterTypeError rejected the command, and the CLI exited with a nonzero code. Scripts that runns doctorcan now read a failed diagnostic as success.The original error text also stays hidden. The spinner's catch discards it, and only a failure mark is shown. Before this change, the user saw a TypeError callstack instead of the original error. Surfacing the original error is a separate gap from the exit status.
A failed diagnostic must still end the command with a nonzero status. The fix must also show the original
getInfoserror to the user. Choose the mechanism that meets both requirements.