-
Notifications
You must be signed in to change notification settings - Fork 2.1k
pyterm: send SIGINT to the subprocess' child #21309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thank you, this fixes the issue of lingering They still linger around when exiting pyterm with ctrl+d though:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -38,8 +38,10 @@ import argparse | |||
import re | |||
import codecs | |||
import platform | |||
import psutil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
SIGINT
to these processes.Testing procedure
Run any arbitrary RIOT application for RIOT native via
make term
and terminatepyterm
(via/exit
or^C
).Check if all RIOT native processes have been terminated.
Issues/PRs references
Fixes #21307