Just use {0,1,2} rather sys.std*.fileno()
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

noironetworks/neutron,watonyweng/neutron,igor-toga/local-snat,klmitch/neutron,apporc/neutron,cisco-openstack/neutron,apporc/neutron,cloudbase/neutron,skyddv/neutron,SamYaple/neutron,paninetworks/neutron,neoareslinux/neutron,MaximNevrov/neutron,openstack/neutron,MaximNevrov/neutron,mattt416/neutron,jacknjzhou/neutron,jacknjzhou/neutron,mahak/neutron,takeshineshiro/neutron,yanheven/neutron,klmitch/neutron,sebrandon1/neutron,paninetworks/neutron,vivekanand1101/neutron,suneeth51/neutron,silenci/neutron,openstack/neutron,javaos74/neutron,shahbazn/neutron,glove747/liberty-neutron,asgard-lab/neutron,barnsnake351/neutron,jumpojoy/neutron,suneeth51/neutron,wolverineav/neutron,javaos74/neutron,dhanunjaya/neutron,chitr/neutron,yanheven/neutron,adelina-t/neutron,cisco-openstack/neutron,eayunstack/neutron,igor-toga/local-snat,barnsnake351/neutron,sasukeh/neutron,skyddv/neutron,chitr/neutron,swdream/neutron,bigswitch/neutron,noironetworks/neutron,jumpojoy/neutron,adelina-t/neutron,cloudbase/neutron,mmnelemane/neutron,huntxu/neutron,huntxu/neutron,openstack/neutron,glove747/liberty-neutron,eayunstack/neutron,sebrandon1/neutron,dhanunjaya/neutron,asgard-lab/neutron,vivekanand1101/neutron,shahbazn/neutron,dims/neutron,sasukeh/neutron,wolverineav/neutron,JianyuWang/neutron,JianyuWang/neutron,mahak/neutron,mattt416/neutron,silenci/neutron,bigswitch/neutron,watonyweng/neutron,swdream/neutron,dims/neutron,takeshineshiro/neutron,neoareslinux/neutron,mmnelemane/neutron,SamYaple/neutron,mahak/neutron