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

Handle spaceless args like '-k32', not just '-k 32' #60

Merged
merged 4 commits into from
Apr 4, 2021
Merged

Handle spaceless args like '-k32', not just '-k 32' #60

merged 4 commits into from
Apr 4, 2021

Conversation

jkbecker
Copy link
Contributor

@jkbecker jkbecker commented Mar 31, 2021

Redid #59 based on the development branch, and improved implementation based on @altendky's feedback.
Fixes #41.


This breaks up known chia plot create arguments when they don't contain a space character between key and value, to prevent faulty arg handling by the Job class.

Example:

>>> cmdline = ['/chia-blockchain/venv/bin/python3.8', 'venv/bin/chia', 'plots', 'create', '-n1', '-k32', '-r12', '-t/plots/tmp', 
'-2/plots/tmp', '-d/plots', '-b9216']

This would usually result in faulty parsing and a StopIteration exception in job.py line 105:

Warning: unrecognized args: -k32 -r
Warning: unrecognized args: 12 -t
Warning: unrecognized args: /plots/tmp -2
Warning: unrecognized args: /plots/tmp -d
Warning: unrecognized args: /plots -b

i.e. completely mismatched argument keys/values.
Solution:

>>> cmdline_argfix(cmdline)
['/chia-blockchain/venv/bin/python3.8', 'venv/bin/chia', 'plots', 'create', '-n', '1', '-k', '32', '-r', '12', '-t', '/plots/tmp', '-2', '/plots/tmp', '-d', '/plots', '-b', '9216']

@altendky altendky mentioned this pull request Apr 3, 2021
2 tasks
@altendky altendky changed the title simple fix #41 Handle spaceless args like '-k32', not just '-k 32' Apr 4, 2021
@altendky altendky merged commit b8918b4 into ericaltendorf:development Apr 4, 2021
@altendky
Copy link
Collaborator

altendky commented Apr 4, 2021

Thanks for the fix. Already have someone else dealing with this too.

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