pyterm: send SIGINT to the subprocess' child#21309
Conversation
|
Thank you, this fixes the issue of lingering They still linger around when exiting pyterm with ctrl+d though: |
benpicco
left a comment
There was a problem hiding this comment.
Works reliable for ctrl+c though
Strange. I never use this but there is a handler in pyterm for that. But apparently it stopped working. Will take a look into it. |
|
Ah, no, it is still working - and for me the problem does not exist. The process is terminated on |
|
Yes I get that but the With ctrl-c I get |
|
Strange. The same code is run but the behavior is different - at least for you. On my computer the output looks similar to the one you have posted but the processes are gone in any case afterwards. |
|
I tested in a OpenSuSE VM: the behavior there is that |
|
Can you give it another try? Should now work with |
|
Yes much better - now it always terminates properly 😃 What system are you on where it's already doing that before? I'm on Ubuntu 24.04 with Python 3.12.3 |
|
Arch Linux with Python 3.13.2. |
5db1d92 to
0de3b8a
Compare
| import re | ||
| import codecs | ||
| import platform | ||
| import psutil |
There was a problem hiding this comment.
@OlegHahm This introduced a new dependency that may not be installed by default. Is there an alternative to it or should we add psutil to the list of dependencies stated on https://doc.riot-os.org/getting-started.html?
There was a problem hiding this comment.
I believe this has broken pyterm for me. I now get:
josh@dragonkite:ds18$ make BOARD=stm32f429i-disc1 term
/home/josh/riot/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" -ln "/tmp/pyterm-josh" -rn "2025-04-09_22.09.13-tests_ds18-stm32f429i-disc1"
Traceback (most recent call last):
File "/home/josh/riot/dist/tools/pyterm/pyterm", line 41, in <module>
import psutil
ModuleNotFoundError: No module named 'psutil'
make: *** [/home/josh/riot/tests/drivers/ds18/../../../Makefile.include:873: term] Error 1There was a problem hiding this comment.
Yes, you will need to install the Python psutil module. I didn't realize that psutil is not a standard Python module. 😔 If anyone would find the time to re-implement this feature without an external modul that would be wonderful.
There was a problem hiding this comment.
I think it is sufficient to add it to the list of pkgs to install in the getting started guide. See #21399.
Contribution description
Upon terminating pyterm any potentially spawned process (such as RIOT native) should be terminated as well. This could be done via sending a
SIGINTto these processes.Testing procedure
Run any arbitrary RIOT application for RIOT native via
make termand terminatepyterm(via/exitor^C).Check if all RIOT native processes have been terminated.
Issues/PRs references
Fixes #21307