(self, cmd_l)
return status
runc without a terminal
runc without a terminal
runc without a terminal
def run_nopty(self, cmd_l):
        """runc without a terminal"""
        (pmaster, pslave) = os.openpty()
        status = subprocess.Popen(cmd_l, shell=False, close_fds=True,
                                  stdout=pslave, stderr=pslave)
        os.close(pslave)
        while True:
            status.poll()
            if status.returncode is not None:
                break
            readable, dummy, exception = \
                select.select([pmaster, ], [], [pmaster, ], 5)
            if exception:
                break
            if readable:
                try:
                    if sys.version_info[0] >= 3:
                        sys.stdout.write(os.read(pmaster, 1).decode())
                    else:
                        sys.stdout.write(os.read(pmaster, 1))
                except OSError:
                    break
        try:
            status.terminate()
        except OSError:
            pass
        self._filebind.finish()
        return status
def run_nopty ( self , cmd_l ) : ( pmaster , pslave ) = os . openpty ( ) status = subprocess . Popen ( cmd_l , shell = False , close_fds = True , stdout = pslave , stderr = pslave ) os . close ( pslave ) while True : status . poll ( ) if status . returncode is not None : break readable , dummy , exception = select . select ( [ pmaster , ] , [ ] , [ pmaster , ] , 5 ) if exception : break if readable : try : if sys . version_info [ 0 ] >= 3 : sys . stdout . write ( os . read ( pmaster , 1 ) . decode ( ) ) else : sys . stdout . write ( os . read ( pmaster , 1 ) ) except OSError : break try : status . terminate ( ) except OSError : pass self . _filebind . finish ( ) return status