From 247cf2b215c8ccc3f46491a4965fc356fce02922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Diot?= Date: Thu, 8 Aug 2024 17:07:32 +0100 Subject: [PATCH] Fix shenanigans with subprocess.Popen and the text argument with rhel --- src/linux/Dockerfile-fedora | 2 +- src/linux/Dockerfile-rhel | 2 +- src/linux/Dockerfile-rhel9 | 2 +- src/ui/client/build.py | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/linux/Dockerfile-fedora b/src/linux/Dockerfile-fedora index a37bfcb4c..11895c0d7 100644 --- a/src/linux/Dockerfile-fedora +++ b/src/linux/Dockerfile-fedora @@ -37,7 +37,7 @@ RUN export MAKEFLAGS="-j$(nproc)" && \ # Install node and npm to build vite frontend RUN curl -fsSL https://rpm.nodesource.com/setup_20.x | bash - && \ - dnf install -y --setopt=install_weak_deps=False nodejs +dnf install -y --setopt=install_weak_deps=False nodejs # Copy files # can't exclude deps from . so we are copying everything by hand diff --git a/src/linux/Dockerfile-rhel b/src/linux/Dockerfile-rhel index c9baa3c18..cb36d6c3d 100644 --- a/src/linux/Dockerfile-rhel +++ b/src/linux/Dockerfile-rhel @@ -48,7 +48,7 @@ RUN export MAKEFLAGS="-j$(nproc)" && \ # Install node and npm to build vite frontend RUN curl -fsSL https://rpm.nodesource.com/setup_20.x | bash - && \ - dnf install -y --setopt=install_weak_deps=False nodejs + dnf install -y --setopt=install_weak_deps=False nodejs # Copy files # can't exclude deps from . so we are copying everything by hand diff --git a/src/linux/Dockerfile-rhel9 b/src/linux/Dockerfile-rhel9 index 223563b1d..f56d31b5d 100644 --- a/src/linux/Dockerfile-rhel9 +++ b/src/linux/Dockerfile-rhel9 @@ -51,7 +51,7 @@ RUN export MAKEFLAGS="-j$(nproc)" && \ # Install node and npm to build vite frontend RUN curl -fsSL https://rpm.nodesource.com/setup_20.x | bash - && \ - dnf install -y --setopt=install_weak_deps=False nodejs + dnf install -y --setopt=install_weak_deps=False nodejs # Copy files # can't exclude deps from . so we are copying everything by hand diff --git a/src/ui/client/build.py b/src/ui/client/build.py index ada7060eb..3721c702e 100644 --- a/src/ui/client/build.py +++ b/src/ui/client/build.py @@ -46,16 +46,16 @@ def run_command(command: List[str]) -> int: """Utils to run a subprocess command. This is usefull to run npm commands to build vite project""" print(f"Running command: {command}", flush=True) try: - process = Popen(command, stdout=PIPE, stderr=PIPE, cwd=current_directory.as_posix(), shell=not bool(getenv("DOCKERFILE", "")), text=True) + process = Popen(command, stdout=PIPE, stderr=PIPE, cwd=current_directory.as_posix(), shell=not bool(getenv("DOCKERFILE", ""))) while process.poll() is None: if process.stdout is not None: for line in process.stdout: - print(line.strip(), flush=True) + print(line.decode("utf-8").strip(), flush=True) if process.returncode != 0: print("Error while running command", flush=True) - print(process.stdout.read(), flush=True) - print(process.stderr.read(), flush=True) + print(process.stdout.read().decode("utf-8"), flush=True) + print(process.stderr.read().decode("utf-8"), flush=True) return 1 except BaseException as e: print(f"Error while running command: {e}", flush=True)