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

Unified Diff: mojo/devtools/common/devtoolslib/android_shell.py

Issue 1414633004: Use file to pass arguments to the shell. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Follow review Created 5 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 | shell/android/apk/AndroidManifest.xml.jinja2 » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/devtools/common/devtoolslib/android_shell.py
diff --git a/mojo/devtools/common/devtoolslib/android_shell.py b/mojo/devtools/common/devtoolslib/android_shell.py
index 611732e045da426e1836253a76d3c78f038f30a8..ab03bb2b5e61fd0725dd34c17a17c36be683fa3d 100644
--- a/mojo/devtools/common/devtoolslib/android_shell.py
+++ b/mojo/devtools/common/devtoolslib/android_shell.py
@@ -15,6 +15,7 @@ import sys
import tempfile
import threading
import time
+import uuid
from devtoolslib.http_server import start_http_server
from devtoolslib.shell import Shell
@@ -349,8 +350,20 @@ class AndroidShell(Shell):
parameters.extend(arguments)
if parameters:
- encodedParameters = json.dumps(parameters)
- cmd += ['--es', 'encodedParameters', encodedParameters]
+ device_filename = (
+ '/sdcard/%s/args_%s' % (_MOJO_SHELL_PACKAGE_NAME, str(uuid.uuid4())))
+ with tempfile.NamedTemporaryFile(delete=False) as temp:
+ try:
+ for parameter in parameters:
+ temp.write(parameter)
+ temp.write('\n')
+ temp.close()
+ subprocess.check_call(self._adb_command(
+ ['push', temp.name, device_filename]))
+ finally:
+ os.remove(temp.name)
+
+ cmd += ['--es', 'argsFile', device_filename]
subprocess.check_call(cmd, stdout=self.verbose_pipe)
« no previous file with comments | « no previous file | shell/android/apk/AndroidManifest.xml.jinja2 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698