"My ping", well I think it is Microsoft's Win7 64 ping and I don't think I have messed with it, throws four pings and then exits with a status code.
I did carefully repeatedly test the code before posting it, both with hosts that would respond and hosts that would not.
Under FreeBSD and OpenBSD "ping -c 4 some.domain.name" will terminate after four pings. And I just tested that.
It looks like it might be the same on Linux, but there are so many variations that I'm never certain and I cannot reach a host to test that.
It looks like it might be the same on a Mac, but I cannot reach a host to test that.
Microsoft appears to use -n instead of -c if you want to change the default number of pings to throw. It will throw a bad option error message and list of options if you try using -c.
Apparently yours never terminates. I suppose you could verify this by opening a command line window and trying it there to see what it does.