Commit 78bcaaaf authored by Adrian DC's avatar Adrian DC
Browse files

fix(platform): always flush on Windows hosts without stdout TTY

Signed-off-by: default avatarAdrian DC <radian.dc@gmail.com>
parent 3b4ec64d
Loading
Loading
Loading
Loading
+8 −1
Changes for src/system/platform.py: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -27,6 +27,9 @@ class Platform:
    IS_TTY_STDOUT: bool = stdout.isatty()
    IS_TTY_UTF8: bool = str(stdout.encoding).lower() == 'utf-8'

    # Outputs
    IS_FLUSH_ENABLED: bool = IS_TTY_STDOUT or IS_WINDOWS

    # Users
    IS_USER_SUDO: bool = ENV_SUDO_USER in environ
    USER_SUDO: str = environ[ENV_SUDO_USER] if IS_USER_SUDO else ''
@@ -36,7 +39,11 @@ class Platform:
    def flush() -> None:

        # Flush output
        print('', end='', flush=Platform.IS_TTY_STDOUT)
        print(
            '',
            end='',
            flush=Platform.IS_FLUSH_ENABLED,
        )

    # Userspace
    @staticmethod