Skip to content

shell: make shell_run run shell forever#12272

Merged
benpicco merged 1 commit intoRIOT-OS:masterfrom
miri64:shell/enh/run-forever
Oct 15, 2019
Merged

shell: make shell_run run shell forever#12272
benpicco merged 1 commit intoRIOT-OS:masterfrom
miri64:shell/enh/run-forever

Conversation

@miri64
Copy link
Member

@miri64 miri64 commented Sep 19, 2019

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()).

Testing procedure

Run tests/shell on 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.

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
@miri64 miri64 added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care. State: demonstrator State: This PR (loosely) demonstrates a concept and is not necessarily meant to be merged. Area: sys Area: System labels Sep 19, 2019
@miri64 miri64 requested a review from kaspar030 September 19, 2019 08:36
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Oct 1, 2019
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@benpicco benpicco merged commit 97d5040 into RIOT-OS:master Oct 15, 2019
@miri64 miri64 deleted the shell/enh/run-forever branch October 16, 2019 02:07
@fjmolinas fjmolinas added this to the Release 2020.01 milestone Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care. State: demonstrator State: This PR (loosely) demonstrates a concept and is not necessarily meant to be merged. Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants