Commit 89e534bb authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Use subprocess.run([…], check=True) and catch errors

parent 22d95912
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -47,9 +47,16 @@ def main(extras, fail_under, editable, files):
		cmd.append('--editable')
	cmd.append(f'.[{join(extras)}]' if extras else '.')

	proc = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
	if proc.returncode:
		sys.stderr.write(proc.stdout)
	try:
		subprocess.run(
			cmd,
			stdout=subprocess.DEVNULL,
			stderr=subprocess.PIPE,
			text=True,
			check=True,
		)
	except subprocess.CalledProcessError as exc:
		sys.stderr.write(exc.stderr)
		sys.exit(3)

	run = lint.Run(files, do_exit=False)