mirror of https://github.com/mongodb/mongo
SERVER-115022: Replace pipes with shlex for Python 3.13 compatibility (#44931)
GitOrigin-RevId: 00e16db1e32b143ccd2b50efc2bf4fa85152147f
This commit is contained in:
parent
b4dbb2d3af
commit
f29045d37e
|
|
@ -8,7 +8,6 @@ import importlib
|
|||
import json
|
||||
import logging
|
||||
import os
|
||||
import pipes
|
||||
import random
|
||||
import re
|
||||
import shlex
|
||||
|
|
@ -1180,7 +1179,7 @@ def get_mongo_client_args(
|
|||
def mongo_shell(mongo_path, work_dir, host_port, mongo_cmds, retries=5, retry_sleep=5):
|
||||
"""Start mongo_path from work_dir, connecting to host_port and executes mongo_cmds."""
|
||||
cmds = "cd {}; echo {} | {} {}".format(
|
||||
pipes.quote(work_dir), pipes.quote(mongo_cmds), pipes.quote(mongo_path), host_port
|
||||
shlex.quote(work_dir), shlex.quote(mongo_cmds), shlex.quote(mongo_path), host_port
|
||||
)
|
||||
attempt_num = 0
|
||||
while True:
|
||||
|
|
@ -1341,15 +1340,15 @@ def resmoke_client(
|
|||
"""Start resmoke client from work_dir, connecting to host_port and executes js_test."""
|
||||
log_output = f">> {log_file} 2>&1" if log_file else ""
|
||||
cmds = (
|
||||
f"cd {pipes.quote(work_dir)};"
|
||||
f"cd {shlex.quote(work_dir)};"
|
||||
f" python {powercycle_constants.RESMOKE_PATH}"
|
||||
f" run"
|
||||
f" --mongo {pipes.quote(mongo_path)}"
|
||||
f" --suites {pipes.quote(resmoke_suite)}"
|
||||
f" --mongo {shlex.quote(mongo_path)}"
|
||||
f" --suites {shlex.quote(resmoke_suite)}"
|
||||
f" --shellConnString mongodb://{host_port}"
|
||||
f" --continueOnFailure"
|
||||
f" --repeat {repeat_num}"
|
||||
f" {pipes.quote(js_test)}"
|
||||
f" {shlex.quote(js_test)}"
|
||||
f" {log_output}"
|
||||
)
|
||||
ret, output = None, None
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
"""Utility to support running a command in a subprocess."""
|
||||
|
||||
import os
|
||||
import pipes
|
||||
import shlex
|
||||
import subprocess
|
||||
|
||||
|
|
@ -31,8 +30,8 @@ class RunCommand(object):
|
|||
|
||||
def add_file(self, path):
|
||||
"""Add a file path to the command."""
|
||||
# For Windows compatability, use pipes.quote around file paths.
|
||||
self._command = "{}{}{}".format(self._command, self._space(), pipes.quote(path))
|
||||
# For Windows compatability, use shlex.quote around file paths.
|
||||
self._command = "{}{}{}".format(self._command, self._space(), shlex.quote(path))
|
||||
|
||||
def _space(self):
|
||||
"""Return a space if the command has been started to be built."""
|
||||
|
|
|
|||
Loading…
Reference in New Issue