Ansible launcher: Write console in thread

Read the console stream from the pipe and write it to a file from
within another thread.  This way the main thread can wait on the
subprocess, and if it exits for any reason, exit the ansible task.

This corrects a problem where our immediate child would exit, but
a grandchild may hold stdout open, preventing us from reaching the
point at which we call wait() on our child.

Change-Id: If983e5b8e0ef27c63490e4b9a135f13a15bf5ae3
Story: #2000619
1 file changed