From e47e56ae8e129565a655eb9f2c5431072411682e Mon Sep 17 00:00:00 2001 From: Darko Lukic Date: Mon, 21 Jun 2021 12:08:58 +0200 Subject: [PATCH] Respawn a process only if `returncode != 0` --- launch/launch/actions/execute_process.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch/launch/actions/execute_process.py b/launch/launch/actions/execute_process.py index dbdb90886..ba1b9b4ad 100644 --- a/launch/launch/actions/execute_process.py +++ b/launch/launch/actions/execute_process.py @@ -766,7 +766,7 @@ 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`)