Files
deskflow/scripts/lib/cmd_utils.py
Nick Bolton 8f13ce8e7a Combine GitHub workflows to reduce config duplication (#7352)
* First attempt merging CI test

* Remove older versions of Linux

* Blend Docker containers and GitHub runners

* Test older configure/build method for Windows

* Re-add old Windows workflow

* Use legacy CMake method for more distros

* Rename image to container

* Reduce config dupe

* Fixed logic for configure

* Use newer build command for Windows

* Move full container name back to matrix (yuk)

* Move GIT_COMMIT to common env

* Use more specific Windows runner name

* Fine-grained timeouts for Mac

* Fixed unit test path for Windows

* Rename CI workflow

* Beginning of macOS dist action

* Update ChangeLog

* More triggers for CI workflow

* Attempt to fix test path on Windows

* Move dist-macos action

* Add dir command for testing

* Remove `test-` job prefix

* Bump msbuild action and try modern cmake again

* Composite actions don't support defaults... grr

* Remove dir diag command

* Trying to use Choco again for VS dep

* Don't skip ninja

* Flush stdout

* Add cl to PATH

* Trying out ilammy/msvc-dev-cmd@v1

* Use @v3 checkout for older Linux

* Fixed comment typo

* Remove dead scripts

* Improve env var names

* Run strip from build dir

* Split out deps script to lib files

* Remove stub action

* Remove dist step for now
2024-06-19 17:48:18 +01:00

20 lines
499 B
Python

import subprocess
import sys
def run(command, check=True):
"""Runs a shell command and by default asserts that the return code is 0."""
command_str = command
if isinstance(command, list):
command_str = " ".join(command)
print(f"Running: {command_str}")
sys.stdout.flush()
try:
subprocess.run(command, shell=True, check=check)
except subprocess.CalledProcessError as e:
print(f"Command failed: {command_str}", file=sys.stderr)
raise e