ros2 / ros2/launch

Return Code not set on SIGINT

Open
#780 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog
Dominant language
Python
Stars
155
Forks
182
Avg merge
2d 14h
Merged PRs (30d)
6

Description

Bug report

  • Operating System:
    • Ubuntu 20.04
  • Installation type:
    • binaries
  • Version or commit hash:
    • foxy
  • Client library (if applicable):
    • N/A
Steps to reproduce issue
from launch import LaunchDescription
from launch.actions import ExecuteProcess

def generate_launch_description():
    ld = LaunchDescription()
    ld.add_action(ExecuteProcess(cmd=['sleep', '5']))
    return ld
Expected behavior
  • If you run the command sleep 5 normally, it has return code 0.
  • If you run it and hit CtrlC, it has the return code 130.
  • If you launch the above lunch file normally, it has the return code 0.
  • If you run it and hit CtrlC, I expect it to return some non-zero code.
Actual behavior

In actuality, it also returns 0.

Additional information

The return code for launch is set on exceptions but the sigint handler does not set the return code and shutsdown the processes "normally".

The best workaround I came up with is an OnShutdown event handler with an OpaqueFunction to save the value of event.reason but that doesn't seem great.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with launch/launch/launch_service.py, especially the SIGINT handler and the exception-based return-code handling linked in the issue. Reproduce the provided ExecuteProcess example on Ubuntu 20.04 with Ctrl-C, then verify that launch exits with a non-zero return code instead of 0.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.