Commit 6c6db1e5 authored by André Anjos's avatar André Anjos 💬

[bootstrap] Revert previous commits

parent 71cd821d
Pipeline #26198 passed with stages
in 9 minutes and 44 seconds
......@@ -36,12 +36,9 @@ _INTERVALS = (
import os
import sys
import pty
import glob
import time
import errno
import shutil
import select
import platform
import subprocess
......@@ -96,9 +93,6 @@ def human_time(seconds, granularity=2):
def run_cmdline(cmd, env=None):
'''Runs a command on a environment, logs output and reports status
Copied from:, which is in
turn based on
......@@ -115,42 +109,14 @@ def run_cmdline(cmd, env=None):
start = time.time()
masters, slaves = zip(pty.openpty(), pty.openpty())
with subprocess.Popen(cmd, stdin=slaves[0], stdout=slaves[0],
stderr=slaves[1], env=env) as p:
for fd in slaves:
os.close(fd) # no input
readable = {
masters[0]: sys.stdout.buffer, # store buffers seperately
masters[1]: sys.stderr.buffer,
while readable:
for fd in, [], [])[0]:
data =, 1024) # read available
except OSError as e:
if e.errno != errno.EIO:
raise #XXX cleanup
del readable[fd] # EIO means EOF on some systems
if not data: # EOF
del readable[fd]
if fd == masters[0]: # We caught stdout
else: # We caught stderr
for fd in masters:
if p.returncode != 0:
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
env=env, bufsize=1, universal_newlines=True)
for line in iter(p.stdout.readline, ''):
if p.wait() != 0:
raise RuntimeError("command `%s' exited with error state (%d)" % \
(' '.join(cmd), p.returncode))
......@@ -159,6 +125,7 @@ def run_cmdline(cmd, env=None):'command took %s' % human_time(total))
def touch(path):
'''Python-implementation of the "touch" command-line application'''
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment