Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(905)

Unified Diff: build/android/pylib/cmd_helper.py

Issue 666943002: Revert of New run shell implementation for DeviceUtils (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/pylib/cmd_helper_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/cmd_helper.py
diff --git a/build/android/pylib/cmd_helper.py b/build/android/pylib/cmd_helper.py
index ab9105411c784b31a9d2e72e4b91648689035057..aba00be735368e9e931e321b14bef1d46ad1fbf3 100644
--- a/build/android/pylib/cmd_helper.py
+++ b/build/android/pylib/cmd_helper.py
@@ -9,7 +9,6 @@
import pipes
import select
import signal
-import string
import StringIO
import subprocess
import time
@@ -19,52 +18,6 @@
import fcntl
except ImportError:
fcntl = None
-
-_SafeShellChars = frozenset(string.ascii_letters + string.digits + '@%_-+=:,./')
-
-def SingleQuote(s):
- """Return an shell-escaped version of the string using single quotes.
-
- Reliably quote a string which may contain unsafe characters (e.g. space,
- quote, or other special characters such as '$').
-
- The returned value can be used in a shell command line as one token that gets
- to be interpreted literally.
-
- Args:
- s: The string to quote.
-
- Return:
- The string quoted using single quotes.
- """
- return pipes.quote(s)
-
-def DoubleQuote(s):
- """Return an shell-escaped version of the string using double quotes.
-
- Reliably quote a string which may contain unsafe characters (e.g. space
- or quote characters), while retaining some shell features such as variable
- interpolation.
-
- The returned value can be used in a shell command line as one token that gets
- to be further interpreted by the shell.
-
- The set of characters that retain their special meaning may depend on the
- shell implementation. This set usually includes: '$', '`', '\', '!', '*',
- and '@'.
-
- Args:
- s: The string to quote.
-
- Return:
- The string quoted using double quotes.
- """
- if not s:
- return '""'
- elif all(c in _SafeShellChars for c in s):
- return s
- else:
- return '"' + s.replace('"', '\\"') + '"'
def Popen(args, stdout=None, stderr=None, shell=None, cwd=None, env=None):
@@ -135,7 +88,7 @@
elif shell:
raise Exception('array args must be run with shell=False')
else:
- args_repr = ' '.join(map(SingleQuote, args))
+ args_repr = ' '.join(map(pipes.quote, args))
s = '[host]'
if cwd:
« no previous file with comments | « no previous file | build/android/pylib/cmd_helper_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698