[riot-notifications] [RIOT-OS/RIOT] sys/shell: Exit the shell on ctrl-D or ctrl-C. (#10788)

Juan I Carrano notifications at github.com
Wed Jan 16 17:51:38 CET 2019


### Contribution description

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".

### Testing procedure

To be able to test this I had to do a couple of modifications to `tests/shell`.

- Fix the use of python dictionaries: 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. The commands in this test were stored in a dict.

- Use miniterm instead of pyterm: pyterm messes up control characters, so the test was changed to use
miniterm.py instead.

Run the test in `tests/shell` with `native` _and_ with a board.

### Related PRs

#10105 introduced the possibility of exiting the shell, but there was really no way to do it in a board.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * sys/shell: Exit the shell on ctrl-D or ctrl-C.
  * tests/shell: use tuple instead of dictionary in test scripts.
  * tests/shell: test shell exit with ctrl-D and ctrl-C.

-- File Changes --

    M sys/shell/shell.c (2)
    M tests/shell/Makefile (5)
    M tests/shell/main.c (8)
    A tests/shell/miniterm.sh (33)
    M tests/shell/tests/01-run.py (40)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/10788.patch
https://github.com/RIOT-OS/RIOT/pull/10788.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/10788
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190116/6d662aba/attachment.html>


More information about the notifications mailing list