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

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: 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
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..79092f7c5ce8dd4c6cc9f51e869f0e3af292ab90 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/%s' % (_MOJO_SHELL_PACKAGE_NAME, str(uuid.uuid4())))
ppi 2015/10/29 16:27:40 Should we push this to some /cache/ folder so that
ppi 2015/10/29 16:27:40 can you append or prepend "mojo_shell_args" to the
qsr 2015/10/29 16:57:02 Not that I know of. Cache folder are in the app ow
qsr 2015/10/29 16:57:02 It is already in a folder with the shell package n
+ 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', 'parametersFile', device_filename]
ppi 2015/10/29 16:27:40 Should we call it argsFile for consistency?
qsr 2015/10/29 16:57:02 Done.
subprocess.check_call(cmd, stdout=self.verbose_pipe)

Powered by Google App Engine
This is Rietveld 408576698