Any recursion that does not have a terminating condition will try to
recurse infinitely ;-)

I'm passing a command line flag in such situations - when testing, but the
best option depends on the particular use. Elsewhere, in a command that
starts a server or talks to the server, I used, for example, an ephemeral
@named socket, which nicely handled both the termination condition and the
communication and is even safe for concurrent processes competing with each
other.

On Thu, Oct 27, 2022, 18:05 Vjeran <vfist...@gmail.com> wrote:

> We have a program that forks itself in order to do some work
> so calling `./program do` internally finds its path using os.Executable
> and calls `./program do2`
>
> Now when trying to do integration tests program spawns itself and repeats
> test causing an infinite loop?
>
> Any ideas how to handle it?
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/6f62afc4-af7a-4548-85c5-6514c2e20a49n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/6f62afc4-af7a-4548-85c5-6514c2e20a49n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAA40n-W%2BfpjUECDrQhbEEzc%2B-F-Zd6M1h11K5UacwJMHSPaPUw%40mail.gmail.com.

Reply via email to