mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Remove pipes module and use shlex instead
Thanks: https://github.com/tox-dev/tox/pull/2418/files Closes #373
This commit is contained in:
parent
47b337143c
commit
494f498d17
2 changed files with 4 additions and 5 deletions
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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(
|
||||||
|
|
Loading…
Reference in a new issue