[riot-notifications] [RIOT-OS/RIOT] shell: make shell_run run shell forever (#12272)

Martine Lenders notifications at github.com
Thu Sep 19 10:36:16 CEST 2019



<!--
The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.
-->

### Contribution description
This change is in preparation to [PR 10788]. PR 10788 will make the
shell exitable which may lead to unexpected behavior in comparison to
previous usage of the shell.

To prevent this, this PR introduces two "new" functions to the shell's
API: `shell_run_once()` and `shell_run_forever()`.

`shell_run_once()` basically has the same behavior as `shell_run()` in
current master: Start a shell and continue reading lines until EOF is
reached.

`shell_run_forever()` wraps around `shell_run_once()` and restarts the
shell if it exits.

`shell_run()` is re-introduced as a back-porting alias for
`shell_run_forever()`.

As a consequence all current calls to `shell_run()` won't exit even
with [PR 10788] merged (which would add EOT as additional exit
condition for `shell_run_once()`).

[PR 10788]: https://github.com/RIOT-OS/RIOT/pull/10788

<!--
Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes
-->


### Testing procedure
Run `tests/shell` on any board of your choice. It should still succeed.
<!--
Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output
-->


### Issues/PRs references
Demonstrator for a proposal in https://github.com/RIOT-OS/RIOT/pull/10788#issuecomment-533003772.

Should be merged before #10788 to not change behavior.
<!--
Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.
-->

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/12272

-- Commit Summary --

  * shell: make shell_run run shell forever

-- File Changes --

    M sys/include/shell.h (32)
    M sys/shell/shell.c (3)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/12272.patch
https://github.com/RIOT-OS/RIOT/pull/12272.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/12272
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190919/ec4c52d3/attachment.htm>


More information about the notifications mailing list