Spawn merges in subprocesses to prevent bleeding locks.

If emerge forgets to release a lock (for example, due to
an error), we should make sure to release it. To ensure
this, I've moved the merge into a subprocess and made
sure we close all open file handles. I've also switched
over to using the Portage _setup_pipes function to setup
stdin, stdout, and stderr instead of mucking with them
by hand.

BUG=chromium-os:20669
TEST=Run some sample emerges.

Reviewed-on: http://gerrit.chromium.org/gerrit/8871
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: David James <davidjames@chromium.org>
(cherry picked from commit 1ed3e25e5e19d2387979093a4c330a7d8c289069)

Change-Id: I9bbb63ef4532f2d33749f4c6c072dedb3192297c
Reviewed-on: http://gerrit.chromium.org/gerrit/10262
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Tested-by: David James <davidjames@chromium.org>
1 file changed