$self->_child($pid);
}
else {
+ # Only the parent process needs to watch for changes, so the child
+ # should release any resources held by the watcher:
+ $self->_clear_watcher;
$self->start_sub->();
}
}
return unless kill 0, $self->_child;
- local $SIG{CHLD} = 'IGNORE';
die "Cannot send INT signal to ", $self->_child, ": $!"
unless kill 'INT', $self->_child;
+ # If we don't wait for the child to exit, we could attempt to
+ # start a new server before the old one has given up the port it
+ # was listening on.
+ wait;
}
+__PACKAGE__->meta->make_immutable;
+
1;
__END__