Factor out the fork/exec/parse logic

This will be common across all commands.

Signed-off-by: David Scott <dave.scott@citrix.com>