17667 - run() call in an agent can return incorrect Process::Status

A child process can only be reaped once. Calling waitpid(cid) in a
separate thread creates a race condition between the "main" systememu
thread and the "guardian" thread.  In case the guardian thread reaps the
child process, the $? variable is not properly updated in the "main"
thread and the wrong exist status (of the previous reaped child process)
is returned by systemu.

By calling waitpid non-blocking in a loop we make sure the child process
is always reaped by the main thread unless it was killed before the
child finished.
17667 - run() call in an agent can return incorrect Process::Status

Changelog