Bug report
Required Info:
- Operating System: Ubuntu 22.04
- Installation type: binaries
- Version or commit hash: 1.0.4
- DDS implementation: n/a
- Client library (if applicable): n/a
Steps to reproduce issue
Create test.py
import time
import sys
try:
time.sleep(100)
except KeyboardInterrupt:
print("Exiting due to interrupt")
sys.exit(0)
In the same directory, create test.launch.py
from launch import LaunchDescription
from launch.actions import ExecuteProcess
def generate_launch_description():
return LaunchDescription([
ExecuteProcess(
cmd=['python3', './test.py'],
shell=True,
output='screen',
)
])
Run ros2 launch test.launch.py. After a few seconds, type Ctrl-C.
Expected behavior
The test.py process to exit cleanly.
Actual behavior
It shows an error saying the process has died
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [python3-1]: process started with pid [1524803]
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[python3-1] Exiting due to interrupt
[ERROR] [python3-1]: process has died [pid 1524803, exit code -2, cmd 'python3 ./test.py'].
Additional information
Running python3 test.py itself and interrupting with Ctrl-c results in a 0 exit code, so it's not clear why the behavior is different when run through launch. This also only happens if shell=True. When shell=False or omitted, I get
[INFO] [python3-1]: process started with pid [1524563]
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[python3-1] Exiting due to interrupt
[INFO] [python3-1]: process has finished cleanly [pid 1524563]
Bug report
Required Info:
Steps to reproduce issue
Create
test.pyIn the same directory, create
test.launch.pyRun
ros2 launch test.launch.py. After a few seconds, typeCtrl-C.Expected behavior
The
test.pyprocess to exit cleanly.Actual behavior
It shows an error saying the process has died
Additional information
Running
python3 test.pyitself and interrupting withCtrl-cresults in a0exit code, so it's not clear why the behavior is different when run throughlaunch. This also only happens ifshell=True. Whenshell=Falseor omitted, I get