Skip to content

Commit

Permalink
Fix shenanigans with subprocess.Popen and the text argument with rhel
Browse files Browse the repository at this point in the history
  • Loading branch information
TheophileDiot committed Aug 8, 2024
1 parent 1f16121 commit 247cf2b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/linux/Dockerfile-fedora
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/linux/Dockerfile-rhel
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/linux/Dockerfile-rhel9
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/ui/client/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 247cf2b

Please sign in to comment.