Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace pipes.quote with shlex.quote on Python 3 #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions coloredlogs/converter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@
# Standard library modules.
import codecs
import os
import pipes
import re
import subprocess
import tempfile

try:
from shlex import quote # Python 3
except ImportError:
from pipes import quote # Python 2 (removed in 3.13)

# External dependencies.
from humanfriendly.terminal import (
ANSI_CSI,
Expand Down Expand Up @@ -75,7 +79,7 @@ def capture(command, encoding='UTF-8'):
#
# [1] http://man7.org/linux/man-pages/man1/script.1.html
# [2] https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/script.1.html
command_line = ['script', '-qc', ' '.join(map(pipes.quote, command)), '/dev/null']
command_line = ['script', '-qc', ' '.join(map(quote, command)), '/dev/null']
script = subprocess.Popen(command_line, stdout=subprocess.PIPE, stderr=dev_null)
stdout, stderr = script.communicate()
if script.returncode == 0:
Expand Down