while (waitpid ($pid, WNOHANG) == 0) {
# Read and print out pipe data.
my ($len) = length ($buf);
waitpid ($pid, 0), last
if sysread ($in, $buf, 4096, $len) <= 0;
while (waitpid ($pid, WNOHANG) == 0) {
# Read and print out pipe data.
my ($len) = length ($buf);
waitpid ($pid, 0), last
if sysread ($in, $buf, 4096, $len) <= 0;