Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
escape parenthesis when running script using shell=True
Browse files Browse the repository at this point in the history
  • Loading branch information
iLLiCiTiT committed Aug 27, 2024
1 parent 05a1bdd commit 3b0bbbe
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ def process(self, instance):

subprocess_jpeg = " ".join(jpeg_items)

if os.getenv("SHELL") in ("/bin/bash", "/bin/sh"):
# Escape parentheses for bash
subprocess_jpeg = (
subprocess_jpeg
.replace("(", "\\(")
.replace(")", "\\)")
)

# run subprocess
self.log.debug("Executing: {}".format(subprocess_jpeg))
run_subprocess(
Expand Down
7 changes: 7 additions & 0 deletions openpype/plugins/publish/extract_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,13 @@ def _render_output_definitions(
raise NotImplementedError

subprcs_cmd = " ".join(ffmpeg_args)
if os.getenv("SHELL") in ("/bin/bash", "/bin/sh"):
# Escape parentheses for bash
subprcs_cmd = (
subprcs_cmd
.replace("(", "\\(")
.replace(")", "\\)")
)

# run subprocess
self.log.debug("Executing: {}".format(subprcs_cmd))
Expand Down
8 changes: 8 additions & 0 deletions openpype/plugins/publish/extract_review_slate.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@ def process(self, instance):
]
slate_subprocess_cmd = " ".join(slate_args)

if os.getenv("SHELL") in ("/bin/bash", "/bin/sh"):
# Escape parentheses for bash
slate_subprocess_cmd = (
slate_subprocess_cmd
.replace("(", "\\(")
.replace(")", "\\)")
)

# run slate generation subprocess
self.log.debug(
"Slate Executing: {}".format(slate_subprocess_cmd)
Expand Down
8 changes: 8 additions & 0 deletions openpype/plugins/publish/extract_thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,14 @@ def _create_thumbnail_ffmpeg(self, src_path, dst_path):
# output file
jpeg_items.append(path_to_subprocess_arg(dst_path))
subprocess_command = " ".join(jpeg_items)
if os.getenv("SHELL") in ("/bin/bash", "/bin/sh"):
# Escape parentheses for bash
subprocess_command = (
subprocess_command
.replace("(", "\\(")
.replace(")", "\\)")
)

try:
run_subprocess(
subprocess_command, shell=True, logger=self.log
Expand Down

0 comments on commit 3b0bbbe

Please sign in to comment.