Skip to content
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

os: Fix index out of range error in the exit method #296

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dnbsd
Copy link

@dnbsd dnbsd commented Dec 24, 2024

This fixes index of out range error when os.exit is invoked without arguments. The issue is caused by falling through the if statement.


Steps to reproduce:

$ cat > /tmp/runme.risor
import os
os.exit()
$ risor --virtual-os /tmp/runme.risor
panic: runtime error: index out of range [0] with length 0

When the method is invoked without arguments it expects that the
implementation of OS' Exit terminates the execution. However, this may
not be the case in some implementations (i.e. VirtualOS).
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.

1 participant