Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: Zac Medico <zmedico@g.o>, gentoo-portage-dev@l.g.o, Mike Gilbert <floppym@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] process: redirect IPv6 'ip' command output to /dev/null
Date: Fri, 02 Aug 2019 19:45:39
Message-Id: 1fcdf6d1-1e3e-f269-8846-07c989d47dc7@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] process: redirect IPv6 'ip' command output to /dev/null by Zac Medico
1 On 8/2/19 10:49 AM, Zac Medico wrote:
2 > On 8/2/19 9:06 AM, Mike Gilbert wrote:
3 >> Bug: https://bugs.gentoo.org/691290
4 >> Signed-off-by: Mike Gilbert <floppym@g.o>
5 >> ---
6 >> lib/portage/process.py | 4 +++-
7 >> 1 file changed, 3 insertions(+), 1 deletion(-)
8 >>
9 >> diff --git a/lib/portage/process.py b/lib/portage/process.py
10 >> index 77f7fac02..4d5a42a8c 100644
11 >> --- a/lib/portage/process.py
12 >> +++ b/lib/portage/process.py
13 >> @@ -478,7 +478,9 @@ def _configure_loopback_interface():
14 >>
15 >> try:
16 >> subprocess.call(['ip', 'address', 'add', '10.0.0.1/8', 'dev', 'lo'])
17 >> - subprocess.call(['ip', 'address', 'add', 'fd00::1/8', 'dev', 'lo'])
18 >> + with open('/dev/null', 'wb') as devnull:
19 >> + subprocess.call(['ip', 'address', 'add', 'fd00::1/8', 'dev', 'lo'],
20 >> + stdout=devnull, stderr=devnull)
21 >> except OSError as e:
22 >> writemsg("Error calling 'ip': %s\n" % e.strerror, noiselevel=-1)
23 >>
24 >>
25 >
26 > Looks good, but let's use the os.devnull constant. Please merge.
27 >
28
29 Also, since buffering is pointless when the raw file descriptor is
30 passed to a subprocess, it's best practice to use open(os.devnull, 'wb', 0).
31 --
32 Thanks,
33 Zac

Attachments

File name MIME type
signature.asc application/pgp-signature