commit | 73b2f1902cef115b6f446b60f1e7389392ff3df1 | [log] [tgz] |
---|---|---|
author | Bill Napier <napier@google.com> | Tue May 18 11:22:18 2010 -0700 |
committer | Bill Napier <napier@google.com> | Tue May 18 11:22:18 2010 -0700 |
tree | a3ee0bad07959c26e7e0b5afefa187b49e524199 | |
parent | 83094202caca2002f164c4950f24d2a3baf238c0 [diff] |
Add in method to ScriptRunner to also get a variable result from the interpreter. Change-Id: Ib14d48992b66371a6702a7dac621bf3a62d1a936
diff --git a/tools/monkeyrunner/src/com/android/monkeyrunner/ScriptRunner.java b/tools/monkeyrunner/src/com/android/monkeyrunner/ScriptRunner.java index 2c145e6..c027be8 100644 --- a/tools/monkeyrunner/src/com/android/monkeyrunner/ScriptRunner.java +++ b/tools/monkeyrunner/src/com/android/monkeyrunner/ScriptRunner.java
@@ -73,6 +73,13 @@ python.exec(script); } + public static PyObject runStringAndGet(String script, String name) { + initPython(); + PythonInterpreter python = new PythonInterpreter(); + python.exec(script); + return python.get(name); + } + private static void initPython() { List<String> arg = Collections.emptyList(); initPython(arg, new String[] {""});