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.

TEST=Run some sample emerges.

Reviewed-by: Brian Harring <>
Tested-by: David James <>
(cherry picked from commit 1ed3e25e5e19d2387979093a4c330a7d8c289069)

Change-Id: I2f5813c49760327f7a17e332526eacdd90197434
Reviewed-by: David James <>
Tested-by: David James <>
1 file changed