launch icon indicating copy to clipboard operation
launch copied to clipboard

Re-spawn a process only if `returncode != 0`

Open lukicdarkoo opened this issue 4 years ago • 10 comments

I believe there is a missing condition returncode != 0 when respawning a process. I have a process that finishes cleanly after a short time, but the launcher keeps respawning it. With the condition (returncode != 0) it works fine.

lukicdarkoo avatar Jun 21 '21 10:06 lukicdarkoo

@lukicdarkoo have you considered:

With that in mind, I'd suggest we add support for a condition to respawn in addition to plain booleans, instead of hard-coding this check.

?

hidmic avatar Jul 05 '21 13:07 hidmic

@lukicdarkoo have you considered:

With that in mind, I'd suggest we add support for a condition to respawn in addition to plain booleans, instead of hard-coding this check.

?

Sounds very good to me, but I understood that @ivanpauno and @wjwwood have to agree or contribute to the idea?

lukicdarkoo avatar Jul 26 '21 06:07 lukicdarkoo

With that in mind, I'd suggest we add support for a condition to respawn in addition to plain booleans, instead of hard-coding this check. @ivanpauno @wjwwood for feedback.

Sounds fair, but how do you get the return code in the condition?

ivanpauno avatar Jul 26 '21 13:07 ivanpauno

Sounds fair, but how do you get the return code in the condition?

Hmm. Didn't put a lot of thought to it. Temporarily pushing it to context.locals is one option.

hidmic avatar Jul 26 '21 13:07 hidmic

Hmm. Didn't put a lot of thought to it. Temporarily pushing it to context.locals is one option.

That works, but it's really weird IMO. I would rather let the user pass a callback which takes the return code as its only argument. We could also accept a two arguments version, where the second one is the context, though I don't think that's really useful.

ivanpauno avatar Jul 26 '21 14:07 ivanpauno

I would rather let the user pass a callback which takes the return code as its only argument.

Right, but that'd make it impossible to leverage the feature from non-Python launch files.

I'm onboard with accepting callbacks for user convenience, but we have to accept a condition as well i.e. a construct that actually lives in launch conceptual domain.

hidmic avatar Jul 26 '21 14:07 hidmic

Okay, pushing it to context.locals sounds fair to me.

ivanpauno avatar Jul 26 '21 15:07 ivanpauno

Okay, pushing it to context.locals sounds fair to me.

Same.

wjwwood avatar Jul 26 '21 23:07 wjwwood

@lukicdarkoo will you be moving forward with this?

hidmic avatar Oct 29 '21 14:10 hidmic

@lukicdarkoo friendly ping

hidmic avatar Mar 21 '22 18:03 hidmic