cros_build_lib: _Popen: workaround Python 3.4.1+ subprocess locking bug

Python 3.4.1 changed behavior where Popen APIs cannot be used from a
signal handler when the Popen object was in use when the signal was
delivered due to holding a threading lock.  Add some internal helpers
to workaround it.

See the upstream bug report for more details:
https://bugs.python.org/issue25960

BUG=chromium:1022187
TEST=CQ passes

Change-Id: I76d71351cde8061bd6b50ec4512209e09bbf543d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2068782
Reviewed-by: Chris McDonald <cjmcdonald@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2341294
Reviewed-by: Mike Frysinger <vapier@chromium.org>
1 file changed