~longsleep/snapcraft/snapcraft-debs-plugin

« back to all changes in this revision

Viewing changes to snapcraft/common.py

  • Committer: Snappy Tarmac
  • Author(s): Ted Gould
  • Date: 2015-09-22 23:14:22 UTC
  • mfrom: (181.2.3 multi-python-version)
  • Revision ID: snappy_tarmac-20150922231422-2p9rklcy3003y2tx
Choose the python path based on the version installed by ted approved by sergiusens

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
        return subprocess.call(['/bin/sh', f.name] + cmd, **kwargs) == 0
50
50
 
51
51
 
 
52
def run_output(cmd, **kwargs):
 
53
    assert isinstance(cmd, list), "run command must be a list"
 
54
    # FIXME: This is gross to keep writing this, even when env is the same
 
55
    with tempfile.NamedTemporaryFile(mode='w+') as f:
 
56
        f.write(assemble_env())
 
57
        f.write('\n')
 
58
        f.write('exec $*')
 
59
        f.flush()
 
60
        return subprocess.check_output(['/bin/sh', f.name] + cmd, **kwargs).decode('utf8').strip()
 
61
 
 
62
 
52
63
def fatal():
53
64
    sys.exit(1)
54
65