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: I2f5813c49760327f7a17e332526eacdd90197434
Reviewed-on: http://gerrit.chromium.org/gerrit/9867
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
1 file changed