-
Notifications
You must be signed in to change notification settings - Fork 52
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
Quick fix for #101 #102
Quick fix for #101 #102
Conversation
Make `repy.py` stop interpreting command-line arguments once it sees the first non-option (which is usually the name of the program to run in the sandbox).
Note that writing unit tests for this is currently held up by SeattleTestbed/utf#60 (I think). |
Check that the Repy sandbox parses command-line arguments correctly.
The unit test I created takes a different approach than originally planned, and now launches the test sandbox from within the |
@@ -331,6 +331,7 @@ def main(): | |||
### anywhere if this is repurposed... | |||
usage = "USAGE: repy.py [options] resource_file program_to_run.r2py [program args]" | |||
parser = optparse.OptionParser(usage=usage) | |||
parser.disable_interspersed_args() |
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.
You may even add a comment explaining the importance of restoring traditional Unix syntax and what can go wrong if command-line options are consumed by repy.py. Not adding a comment here seems like an easy way for a future developer to miss the importance of this behaviour.
Example comment:
disable_interspersed_args()
restores traditional Unix syntax, where option parsing stops with the first non-option argument. disable_interspersed_args()
should be used if you have a command processor which runs another command which has options of its own and you want to make sure these options don’t get confused. For example, each command might have a different set of options.
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.
Great point, thanks. Addressed in 6c20115.
I reviewed the follow-up commits and verified that $ python utf.py -f ut_repyv2api_commandlineargs.py
|
LGTM. Merging. |
Make
repy.py
stop interpreting command-line arguments once it seesthe first non-option (which is usually the name of the program to run
in the sandbox).