Fix: PerlLanguageProvider.executePerlCode terminates JVM on exit()#294
Merged
Fix: PerlLanguageProvider.executePerlCode terminates JVM on exit()#294
Conversation
Previously, when Perl code called exit(), it would call System.exit()
and terminate the entire JVM. This prevented library/embedded use where
the caller wants to continue execution after the script completes.
Changes:
- Add PerlExitException class for Perl's exit() semantics
- WarnDie.exit() now throws PerlExitException instead of System.exit()
- Main.main() catches PerlExitException and converts to System.exit()
- exit() is never caught by Perl's eval{} (matching standard Perl)
- Both JVM compiler and interpreter backends handle this correctly
- END blocks still run before exit (matching standard Perl)
Documentation:
- Updated docs/guides/java-integration.md with "Handling Script Exit" section
Fixes #291
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <noreply@cognition.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #291 -
PerlLanguageProvider.executePerlCodewas terminating the entire JVM when Perl code calledexit(), preventing library/embedded use.Changes:
PerlExitExceptionclass for Perl's exit() semanticsWarnDie.exit()now throwsPerlExitExceptioninstead ofSystem.exit()Main.main()catchesPerlExitExceptionand converts toSystem.exit()for CLI useexit()is never caught by Perl'seval{}(matching standard Perl behavior)Documentation:
docs/guides/java-integration.mdwith "Handling Script Exit" sectionTest plan
Generated with Devin