Skip to content
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

Return Code not set on SIGINT #780

Open
DLu opened this issue May 16, 2024 · 3 comments
Open

Return Code not set on SIGINT #780

DLu opened this issue May 16, 2024 · 3 comments
Labels

Comments

@DLu
Copy link
Contributor

DLu commented May 16, 2024

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.

@audrow
Copy link
Member

audrow commented May 23, 2024

I'm going to mark this as backlog.

It's not 100% clear to me what the right behavior is here. What did we do in ROS 1? There also may be some funniness with Windows.

@audrow audrow added the backlog label May 23, 2024
@mjcarroll
Copy link
Member

So the longer discussion was that it should probably return 130 on ctrl-c, since that is the error code that represents that an interactive application was interrupted.

I don't think anybody would be opposed to launch having that behavior as well.

Adjacent to that, it would be interesting to know how roslaunch did it, and if not returning 130 was keeping in line with that precedent or just an oversight.

Additionally, all bets are off with Windows and how it handles interrupts and return codes, so it would be somewhat worthwhile to try to make the behaviors consistent.

@DLu
Copy link
Contributor Author

DLu commented May 23, 2024

Sad to report that roslaunch returns 0 in most cases except for exceptions (which sigint does not generate)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants