Open azeey opened 10 months ago
Hello, I've come to a Bug that looks related to yours.
Required Info:
If I take the same example as you when I run the launch file with shell=True
. In another terminal, I run the following command:
ps -aux | pgrep -f test.py
I can see two pid, as if the process was launched twice.
user 159666 0.0 0.0 2896 1600 pts/0 S+ 09:22 0:00 /bin/sh -c python3 ./test.py
user 159668 0.2 0.0 22608 9440 pts/0 S+ 09:22 0:00 python3 ./test.py
Maybe it's totally normal, but the thing is when I called that same launch through another launch file (that I will call main.launch.py) where I add :
event_handlers.append(
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=onenode,
on_exit=[EmitEvent(event=Shutdown())],
)
)
)
That allows me to shutdown all the process launched by main.launch.py whenever one particular node is shutting down
Expected behavior The test.py process to exit cleanly.
Actual behavior Only the command /bin/sh -c python3 ./test.py is killed not the command launched by the shell: python3 ./test.py.
If you don't think that is related, i will ask in another ticket.
BR,
Alexis
It looks like the signal is actually not propagated to the subprocess properly. This might actually be the root cause of the problem.
Bug report
Required Info:
Steps to reproduce issue
Create
test.py
In the same directory, create
test.launch.py
Run
ros2 launch test.launch.py
. After a few seconds, typeCtrl-C
.Expected behavior
The
test.py
process to exit cleanly.Actual behavior
It shows an error saying the process has died
Additional information
Running
python3 test.py
itself and interrupting withCtrl-c
results in a0
exit code, so it's not clear why the behavior is different when run throughlaunch
. This also only happens ifshell=True
. Whenshell=False
or omitted, I get