re: #31375 (review)
Why use such an ( && || && ||| )
expression? Would be more readable as:
The suggested code is not equivalent unless you assume that try_exec will never return true. In practice, I agree it should work but it would be fragile and look misleading because unless you know that try_exec does a syscall that never returns in certain cases, a plain reading of the code would lead you to believe incorrectly that the return value of try_exec doesn’t matter and that the same executable is run repeatedly.
Using && and || is more explicit and robust because it makes it explicit that if try_exec succeeds, it is not run again, and it makes the code work regardless of whether try_exec halts or returns.
If the boolean operators are a problem, maybe I can try to find another way to write this doesn’t look misleading and rely on try_exec to never return. But IMO, && and || are nice because these operators are a natural convenience in shell scripts and this wrapper program basically is a shell script.