Skip to content
Open
Show file tree
Hide file tree
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 humanfriendly/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,14 @@
# Standard library modules.
import functools
import getopt
import pipes
import subprocess
import sys

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

# Modules included in our package.
from humanfriendly import (
Timer,
Expand Down Expand Up @@ -176,7 +180,7 @@ def main():
def run_command(command_line):
"""Run an external command and show a spinner while the command is running."""
timer = Timer()
spinner_label = "Waiting for command: %s" % " ".join(map(pipes.quote, command_line))
spinner_label = "Waiting for command: %s" % " ".join(map(quote, command_line))
with Spinner(label=spinner_label, timer=timer) as spinner:
process = subprocess.Popen(command_line)
while True:
Expand Down
8 changes: 6 additions & 2 deletions humanfriendly/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@
import functools
import logging
import os
import pipes
import shutil
import sys
import tempfile
import time
import unittest

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

# Modules included in our package.
from humanfriendly.compat import StringIO
from humanfriendly.text import random_string
Expand Down Expand Up @@ -521,7 +525,7 @@ def __enter__(self):
pathname = os.path.join(directory, self.program_name)
with open(pathname, 'w') as handle:
handle.write('#!/bin/sh\n')
handle.write('echo > %s\n' % pipes.quote(self.program_signal_file))
handle.write('echo > %s\n' % quote(self.program_signal_file))
if self.program_script:
handle.write('%s\n' % self.program_script.strip())
handle.write('exit %i\n' % self.program_returncode)
Expand Down