Skip to content

Instantly share code, notes, and snippets.

@FabienArcellier FabienArcellier/
Last active May 17, 2018

What would you like to do?
template to use python as command engine as you would use bash -ex
#!/usr/bin/env python
import os
import sys
SCRIPT_DIR = os.path.realpath(os.path.join(__file__, '..'))
ROOT_DIR = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
def main(arguments):
os.chdir(ROOT_DIR + '/dev/')
_system('docker-compose up')
# BOILERPLATE TO REPRODUCE -ex behavior of bash
def _system(cmd, logged = True):
if logged:
print('$ {0}'.format(cmd))
output = os.system(cmd)
# see :
error_code = output >> 8
if error_code > 0:
raise OSError(error_code)
if __name__ == '__main__':
except (OSError) as e:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.