Ensure subprocess.run commands succeed with check=True
This commit is contained in:
+11
-4
@@ -61,17 +61,22 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef
|
|||||||
'--name', container_name,
|
'--name', container_name,
|
||||||
'-i',
|
'-i',
|
||||||
'-v', '/:/host', # ignored on CircleCI
|
'-v', '/:/host', # ignored on CircleCI
|
||||||
docker_image, '/bin/bash'])
|
docker_image, '/bin/bash'], check=True)
|
||||||
subprocess.run(['docker', 'cp', os.path.abspath(project_dir) + '/.', container_name + ':/project'])
|
subprocess.run(['docker', 'cp',
|
||||||
|
os.path.abspath(project_dir) + '/.',
|
||||||
|
container_name + ':/project'], check=True)
|
||||||
|
|
||||||
for config in platform_configs:
|
for config in platform_configs:
|
||||||
if dependency_constraints:
|
if dependency_constraints:
|
||||||
constraints_file = dependency_constraints.get_for_python_version(config.version)
|
constraints_file = dependency_constraints.get_for_python_version(config.version)
|
||||||
subprocess.run(['docker', 'cp', os.path.abspath(constraints_file), container_name + ':/constraints.txt'])
|
subprocess.run(['docker', 'cp',
|
||||||
|
os.path.abspath(constraints_file),
|
||||||
|
container_name + ':/constraints.txt'], check=True)
|
||||||
|
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
['docker', 'start', '-i', '-a', container_name],
|
['docker', 'start', '-i', '-a', container_name],
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
|
check=True,
|
||||||
input='''
|
input='''
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
@@ -179,7 +184,9 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef
|
|||||||
)
|
)
|
||||||
|
|
||||||
# copy the output back into the host
|
# copy the output back into the host
|
||||||
subprocess.run(['docker', 'cp', container_name + ':/output/.', os.path.abspath(output_dir)])
|
subprocess.run(['docker', 'cp',
|
||||||
|
container_name + ':/output/.',
|
||||||
|
os.path.abspath(output_dir)], check=True)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
exit(1)
|
exit(1)
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
Reference in New Issue
Block a user