Skip to content

Commit

Permalink
πŸ› godoo_shell Correctly Escape pipe in command and allow stdin passing
Browse files Browse the repository at this point in the history
  • Loading branch information
joshkreud committed Nov 22, 2023
1 parent 4075d08 commit 71a6f51
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/godoo_cli/commands/shell.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import sys
from pathlib import Path
from typing import List

Expand Down Expand Up @@ -42,9 +43,10 @@ def odoo_shell(
"""
shell_cmd = f"{str(odoo_main_path.absolute())}/odoo-bin shell -c {str(odoo_conf_path.absolute())} --no-http"
if pipe_in_command:
pipe_in_command = pipe_in_command.replace('"', '\\"') # Escape Double Quotes
shell_cmd = f'echo "{pipe_in_command}" |' + shell_cmd
LOGGER.debug("Running Command: %s", shell_cmd)
return CLI.returner(run_cmd(shell_cmd).returncode)
return CLI.returner(run_cmd(shell_cmd).returncode)
return CLI.returner(run_cmd(shell_cmd, stdin=sys.stdin).returncode)


def odoo_pregenerate_assets(odoo_main_path: Path):
Expand Down

0 comments on commit 71a6f51

Please sign in to comment.