[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-portage-dev
Subject:    Re: [gentoo-portage-dev] [PATCH] process: redirect IPv6 'ip' command output to /dev/null
From:       Zac Medico <zmedico () gentoo ! org>
Date:       2019-08-02 19:45:35
Message-ID: 1fcdf6d1-1e3e-f269-8846-07c989d47dc7 () gentoo ! org
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


On 8/2/19 10:49 AM, Zac Medico wrote:
> On 8/2/19 9:06 AM, Mike Gilbert wrote:
>> Bug: https://bugs.gentoo.org/691290
>> Signed-off-by: Mike Gilbert <floppym@gentoo.org>
>> ---
>>  lib/portage/process.py | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/portage/process.py b/lib/portage/process.py
>> index 77f7fac02..4d5a42a8c 100644
>> --- a/lib/portage/process.py
>> +++ b/lib/portage/process.py
>> @@ -478,7 +478,9 @@ def _configure_loopback_interface():
>>  
>>  	try:
>>  		subprocess.call(['ip', 'address', 'add', '10.0.0.1/8', 'dev', 'lo'])
>> -		subprocess.call(['ip', 'address', 'add', 'fd00::1/8', 'dev', 'lo'])
>> +		with open('/dev/null', 'wb') as devnull:
>> +			subprocess.call(['ip', 'address', 'add', 'fd00::1/8', 'dev', 'lo'],
>> +				stdout=devnull, stderr=devnull)
>>  	except OSError as e:
>>  		writemsg("Error calling 'ip': %s\n" % e.strerror, noiselevel=-1)
>>  
>>
> 
> Looks good, but let's use the os.devnull constant. Please merge.
> 

Also, since buffering is pointless when the raw file descriptor is
passed to a subprocess, it's best practice to use open(os.devnull, 'wb', 0).
-- 
Thanks,
Zac


["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic