Misc: Util: Add capture3 function

Signed-off-by: Tim Serong <tserong@suse.com>
Misc: Util: Reimplement run_as in terms of capture3

Signed-off-by: Tim Serong <tserong@suse.com>
Misc: Replace popen3 invocations with capture3

Signed-off-by: Tim Serong <tserong@suse.com>
Merge branch 'bnc878597' into next

This replaces popen3 with capture3 to avoid deadlocks when dealing with
excessively large STDERR output (bnc#878597)