Skip to content

Commit

Permalink
[IMP] godoo shell Improvements
Browse files Browse the repository at this point in the history
- Ensure `pipe_in_command` is Properly escaped
- Pass stdin instead
  • Loading branch information
joshkreud committed Nov 21, 2023
1 parent 29d39c9 commit 2e5e476
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, input=sys.stdin).returncode)


def odoo_pregenerate_assets(odoo_main_path: Path):
Expand Down

0 comments on commit 2e5e476

Please sign in to comment.