shell: make shell_run run shell forever#12272
Merged
benpicco merged 1 commit intoRIOT-OS:masterfrom Oct 15, 2019
Merged
Conversation
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]: RIOT-OS#10788
benpicco
approved these changes
Oct 1, 2019
Contributor
benpicco
left a comment
There was a problem hiding this comment.
The change is small and an alias is provided for backwards compatibility.
ACK to further the goal of having unit tests that exit when they finish.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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()andshell_run_forever().shell_run_once()basically has the same behavior asshell_run()incurrent master: Start a shell and continue reading lines until EOF is
reached.
shell_run_forever()wraps aroundshell_run_once()and restarts theshell if it exits.
shell_run()is re-introduced as a back-porting alias forshell_run_forever().As a consequence all current calls to
shell_run()won't exit evenwith PR 10788 merged (which would add EOT as additional exit
condition for
shell_run_once()).Testing procedure
Run
tests/shellon any board of your choice. It should still succeed.Issues/PRs references
Demonstrator for a proposal in #10788 (comment).
Should be merged before #10788 to not change behavior.