]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Just use {0,1,2} rather sys.std*.fileno()
authorAngus Lees <gus@inodes.org>
Fri, 15 May 2015 06:41:33 +0000 (16:41 +1000)
committerAngus Lees <gus@inodes.org>
Wed, 24 Jun 2015 23:35:55 +0000 (09:35 +1000)
commit9b56ef34f76eb1aaf129c1e34df1a6ccfa172c2c
treeace436765cc89b927f81043a615802bbc55e457e
parentae4efdc240d1b08d07e88ffa6a7210815680479c
Just use {0,1,2} rather sys.std*.fileno()

Sometimes sys.std* have been monkeypatched to something other than real
filehandles, and the fileno() method may be missing or return a
misleading value (eg: during test cases).

This change just hard codes the real 0/1/2 file descriptor numbers
rather than trying to find another more stable symbolic name - the
values are well known and as portable as the os.dup2() call being used.

Strongly related to this, this change also moves the relevant flush()
calls before any fork/dup2 funny business, to ensure python buffers are
flushed and only the expected data hits the fds.

Change-Id: I635b3a6a7413ea85d0eac55d9a6e1dbc7402376f
neutron/agent/linux/daemon.py