Properly encode cmd line for popen

Change-Id: I1f7799920b6732a6cd128143dfa7ce282bad25c6
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>