Fixed health check command subprocess handling.

Currently it doesn't check all subprocess future states, and also
creates a pipe to stdin which can cause some scripts to expect stdin
input and blocks.

Review: https://reviews.apache.org/r/23416