Add run and eprint helper functions.

test-6495
Gokhan Gulbiz 2022-12-05 10:01:51 +03:00
parent f058209962
commit 50eee98eff
No known key found for this signature in database
GPG Key ID: 608EF06B6BD1B45B
1 changed files with 12 additions and 0 deletions

View File

@ -295,3 +295,15 @@ def initialize_citus_cluster(bindir, datadir, settings, config):
if config.add_coordinator_to_metadata: if config.add_coordinator_to_metadata:
add_coordinator_to_metadata(bindir, config.coordinator_port()) add_coordinator_to_metadata(bindir, config.coordinator_port())
config.setup_steps() config.setup_steps()
def eprint(*args, **kwargs):
"""eprint prints to stderr"""
print(*args, file=sys.stderr, **kwargs)
def run(command, *args, shell=True, **kwargs):
"""run runs the given command and prints it to stderr"""
eprint(f"+ {command} ")
return subprocess.run(command, *args, check=True, shell=shell, **kwargs)