Remove pipes module and use shlex instead

Thanks: https://github.com/tox-dev/tox/pull/2418/files

Closes #373
This commit is contained in:
Moon Sungjoon 2023-07-23 11:30:27 +09:00 committed by Alex Pyrgiotis
parent 47b337143c
commit 494f498d17
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA
2 changed files with 4 additions and 5 deletions

View file

@ -1,6 +1,5 @@
import logging import logging
import os import os
import pipes
import platform import platform
import shlex import shlex
import subprocess import subprocess
@ -68,7 +67,7 @@ class DangerzoneGui(DangerzoneCore):
args = ["open", "-a", "Preview.app", filename] args = ["open", "-a", "Preview.app", filename]
# Run # Run
args_str = " ".join(pipes.quote(s) for s in args) args_str = " ".join(shlex.quote(s) for s in args)
log.info(Fore.YELLOW + "> " + Fore.CYAN + args_str) log.info(Fore.YELLOW + "> " + Fore.CYAN + args_str)
subprocess.run(args) subprocess.run(args)
@ -89,7 +88,7 @@ class DangerzoneGui(DangerzoneCore):
args[i] = filename args[i] = filename
# Open as a background process # Open as a background process
args_str = " ".join(pipes.quote(s) for s in args) args_str = " ".join(shlex.quote(s) for s in args)
log.info(Fore.YELLOW + "> " + Fore.CYAN + args_str) log.info(Fore.YELLOW + "> " + Fore.CYAN + args_str)
subprocess.Popen(args) subprocess.Popen(args)

View file

@ -3,8 +3,8 @@ import json
import logging import logging
import os import os
import pathlib import pathlib
import pipes
import platform import platform
import shlex
import shutil import shutil
import subprocess import subprocess
import tempfile import tempfile
@ -152,7 +152,7 @@ class Container(IsolationProvider):
document: Document, document: Document,
args: List[str], args: List[str],
) -> int: ) -> int:
args_str = " ".join(pipes.quote(s) for s in args) args_str = " ".join(shlex.quote(s) for s in args)
log.info("> " + args_str) log.info("> " + args_str)
with subprocess.Popen( with subprocess.Popen(