Skip to content

Return exit code from CLI::run(), rather than exiting - #105

Merged
theseer merged 1 commit into
theseer:masterfrom
metaworx:enh/return-exit-code
Sep 18, 2023
Merged

theseer merged 1 commit into
theseer:masterfrom
metaworx:enh/return-exit-code

Conversation

@martin-rueegg

Copy link
Copy Markdown
Contributor

When using CLI from another script, exiting straight from run() method does not allow custom error handling.

Returning the exit code to the invoking script and exiting there allows custom error handling in an external script, while remaining completely backwards-compatible.

@theseer

theseer commented Sep 18, 2023

Copy link
Copy Markdown
Owner

Nice idea. Why ever I hadn't done that in the first place...

Thanks!

@theseer
theseer merged commit 2684aea into theseer:master Sep 18, 2023
@martin-rueegg

Copy link
Copy Markdown
Contributor Author

No worries, and welcome! :-)

However, I just missed two return points! Was just a second to late!

@theseer

theseer commented Sep 18, 2023

Copy link
Copy Markdown
Owner

Just add a new PR for those.

@martin-rueegg

martin-rueegg commented Sep 18, 2023 •

Copy link
Copy Markdown
Contributor Author

Ok, so I'm not creating a new one.

Would you also mind to ad the return type int?

master...metaworx:theseer_autoload:enh/return-exit-code

@theseer

theseer commented Sep 18, 2023

Copy link
Copy Markdown
Owner

Return type hints of int are not PHP 5.3 compliant.

Yes, this project is that old, and I'd have to cleanup a lot to justify the upgrade. Something I'd certainly like to do, but i won't have time for in any somewhat near future.

@martin-rueegg

Copy link
Copy Markdown
Contributor Author

I see. Thanks for the heads-up

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.

2 participants