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

Side by Side Diff: mojo/devtools/common/devtoolslib/linux_shell.py

Issue 1159063004: Support running with mojo:debugger in devtools. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address Ben's comments. Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import subprocess 5 import subprocess
6 6
7 from devtoolslib.shell import Shell 7 from devtoolslib.shell import Shell
8 from devtoolslib import http_server 8 from devtoolslib import http_server
9 9
10 10
(...skipping 19 matching lines...) Expand all
30 30
31 Args: 31 Args:
32 local_dir_path: path to the directory to be served 32 local_dir_path: path to the directory to be served
33 port: port at which the server will be available to the shell 33 port: port at which the server will be available to the shell
34 34
35 Returns: 35 Returns:
36 The url that the shell can use to access the content of |local_dir_path|. 36 The url that the shell can use to access the content of |local_dir_path|.
37 """ 37 """
38 return 'http://%s:%d/' % http_server.StartHttpServer(local_dir_path, port) 38 return 'http://%s:%d/' % http_server.StartHttpServer(local_dir_path, port)
39 39
40 def ForwardHostPortToShell(self, host_port):
41 """Forwards a port on the host machine to the same port wherever the shell
42 is running.
43
44 This is a no-op if the shell is running locally.
45 """
46 pass
47
40 def Run(self, arguments): 48 def Run(self, arguments):
41 """Runs the shell with given arguments until shell exits, passing the stdout 49 """Runs the shell with given arguments until shell exits, passing the stdout
42 mingled with stderr produced by the shell onto the stdout. 50 mingled with stderr produced by the shell onto the stdout.
43 51
44 Returns: 52 Returns:
45 Exit code retured by the shell or None if the exit code cannot be 53 Exit code retured by the shell or None if the exit code cannot be
46 retrieved. 54 retrieved.
47 """ 55 """
48 command = self.command_prefix + [self.executable_path] + arguments 56 command = self.command_prefix + [self.executable_path] + arguments
49 return subprocess.call(command, stderr=subprocess.STDOUT) 57 return subprocess.call(command, stderr=subprocess.STDOUT)
50 58
51 def RunAndGetOutput(self, arguments): 59 def RunAndGetOutput(self, arguments):
52 """Runs the shell with given arguments until shell exits. 60 """Runs the shell with given arguments until shell exits.
53 61
54 Args: 62 Args:
55 arguments: list of arguments for the shell 63 arguments: list of arguments for the shell
56 64
57 Returns: 65 Returns:
58 A tuple of (return_code, output). |return_code| is the exit code returned 66 A tuple of (return_code, output). |return_code| is the exit code returned
59 by the shell or None if the exit code cannot be retrieved. |output| is the 67 by the shell or None if the exit code cannot be retrieved. |output| is the
60 stdout mingled with the stderr produced by the shell. 68 stdout mingled with the stderr produced by the shell.
61 """ 69 """
62 command = self.command_prefix + [self.executable_path] + arguments 70 command = self.command_prefix + [self.executable_path] + arguments
63 p = subprocess.Popen(command, stdout=subprocess.PIPE, 71 p = subprocess.Popen(command, stdout=subprocess.PIPE,
64 stderr=subprocess.STDOUT) 72 stderr=subprocess.STDOUT)
65 (output, _) = p.communicate() 73 (output, _) = p.communicate()
66 return p.returncode, output 74 return p.returncode, output
OLDNEW
« no previous file with comments | « mojo/devtools/common/devtoolslib/android_shell.py ('k') | mojo/devtools/common/devtoolslib/shell.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698