Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion launch/launch/actions/execute_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,8 @@ async def __execute_process(self, context: LaunchContext) -> None:
))
await context.emit_event(ProcessExited(returncode=returncode, **process_event_args))
# respawn the process if necessary
if not context.is_shutdown and not self.__shutdown_future.done() and self.__respawn:
if not context.is_shutdown and not self.__shutdown_future.done() and self.__respawn and \
returncode != 0:
if self.__respawn_delay is not None and self.__respawn_delay > 0.0:
# wait for a timeout(`self.__respawn_delay`) to respawn the process
# and handle shutdown event with future(`self.__shutdown_future`)
Expand Down
2 changes: 1 addition & 1 deletion launch/test/launch/test_execute_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def generate_launch_description():
return LaunchDescription([

ExecuteProcess(
cmd=[sys.executable, '-c', "print('action')"],
cmd=[sys.executable, '-c', "print('action'); false"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukicdarkoo hmm, false is not a valid Python literal.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not the best way to make it crash :) I will change it

respawn=True, respawn_delay=respawn_delay, on_exit=on_exit_callback
),

Expand Down