sys/shell: Add function to call the shell with a list of strings.#9733
sys/shell: Add function to call the shell with a list of strings.#9733jcarrano wants to merge 5 commits intoRIOT-OS:masterfrom
Conversation
There was a problem hiding this comment.
Re the high level aspects of the PR:
- Could you please provide a test?
- Could you please explain briefly why you want to provide a Lua binding to the shell rather than binding to the modules individually, and accessing their commands directly? (Please correct me if my understanding here is inaccurate)
|
@danpetry I added the test. The rebase was unintended (our awesome static-test script did it.) |
Because I won't write individual bindings to modules (other than as an example). This will allow me to provide a system()-like (lua has os.execute but that takes a single string.) The reason for providing such a function from lua is convenience: having an easy to use example application without having to add a lot of code. |
|
LGTM. How about merging the test with tests/shell? |
tests/shell_call/Makefile
Outdated
|
|
||
| include $(RIOTBASE)/Makefile.include | ||
|
|
||
| test: |
There was a problem hiding this comment.
This target is not needed anymore.
There was a problem hiding this comment.
anyhow, please merge the test into tests/shell. They're testing the same module, and tests are kinda expensive for the CI...
Right now the only way to exit the shell is if stdin is closed. This works on native, but on an embedded platform stdin is the uart and thus is never closed. This patch causes the shell loop to exit on: * ETX (ASCII 0x03 / ctrl-C) "End-of-Text". * EOT (ASCII 0x04 / ctrl-D) "End-of-Transmission".
Python dictionaries are not guaranteed to be ordered until version 3.7. In 3.6 they are ordered too, but that is an implementation detail. riotdocker seems to be using 3.5. As it stands now, it would not be a problem if the test commands are run in a random order, except that: - It would result in non-reproduceable tests. - It hinders testing other functionality, such as exiting the shell.
pyterm messes up control characters, so the test was changed to use miniterm.py instead.
The new function makes it easier to call command line tools from within code.
|
I rebased on top of #10788 so that tests can be more easily integrated. |
|
I'm not rebasing this (yet) again. Closing. |
Contribution description
The new function makes it easier to call command line tools from within code.
I'm using it to provide a sort of system()/execl() call from within Lua.
Related PRs
Depends on #10788 to integrate the tests into the main shell tests.