ambuild2/util.py
changeset 61 dc5499429387
parent 56 d771e26e20da
child 67 403dbf216108
     1.1 --- a/ambuild2/util.py	Mon Sep 23 02:04:14 2013 -0700
     1.2 +++ b/ambuild2/util.py	Mon Sep 23 21:49:28 2013 -0700
     1.3 @@ -104,23 +104,16 @@
     1.4    def __exit__(self, type, value, traceback):
     1.5      self.obj.close()
     1.6  
     1.7 -def Execute(argv, exe=None):
     1.8 -  print(' '.join([i for i in argv]))
     1.9 -  args = {
    1.10 -    'args': argv,
    1.11 -    'stdout': subprocess.PIPE,
    1.12 -    'stderr': subprocess.PIPE,
    1.13 -    'shell': False
    1.14 -  }
    1.15 -  if exe:
    1.16 -    argv['executable'] = exe
    1.17 -  p = subprocess.Popen(**args)
    1.18 +def Execute(argv):
    1.19 +  p = subprocess.Popen(
    1.20 +      args=argv,
    1.21 +      stdout=subprocess.PIPE,
    1.22 +      stderr=subprocess.PIPE,
    1.23 +      shell=False
    1.24 +  )
    1.25    stdout, stderr = p.communicate()
    1.26 -  return {
    1.27 -    'process': p,
    1.28 -    'stdout': stdout.decode(),
    1.29 -    'stderr': stderr.decode(),
    1.30 -    'oldstdout': stdout,
    1.31 -    'oldstderr': stderr
    1.32 -  }
    1.33 +  out = stdout.decode()
    1.34 +  err = stderr.decode()
    1.35  
    1.36 +  out = (' '.join([i for i in argv])) + out
    1.37 +  return p, out, err