def exec_command()

in source/eksfedctl/execution.py [0:0]


def exec_command(command, command_stdin=None):
    if command_stdin:
        child = subprocess.Popen(command, stdin=subprocess.PIPE)
        child.communicate(input=command_stdin.encode())
    else:
        child = subprocess.Popen(command)
        child.communicate()

    rc = child.returncode
    if rc != 0:
        raise CommandError(
            f"Command \"{' '.join(child.args)}\" returned exit code {rc}"
        )

    return rc