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

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

Issue 1411503011: devtools: drop Shell.serve_local_directory(). (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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 import threading 6 import threading
7 import tempfile 7 import tempfile
8 8
9 from devtoolslib import http_server 9 from devtoolslib import http_server
10 from devtoolslib.shell import Shell 10 from devtoolslib.shell import Shell
11 from devtoolslib.utils import overrides 11 from devtoolslib.utils import overrides
12 12
13 13
14 class LinuxShell(Shell): 14 class LinuxShell(Shell):
15 """Wrapper around Mojo shell running on Linux. 15 """Wrapper around Mojo shell running on Linux.
16 16
17 Args: 17 Args:
18 executable_path: path to the shell binary 18 executable_path: path to the shell binary
19 command_prefix: optional list of arguments to prepend to the shell command, 19 command_prefix: optional list of arguments to prepend to the shell command,
20 allowing e.g. to run the shell under debugger. 20 allowing e.g. to run the shell under debugger.
21 """ 21 """
22 22
23 def __init__(self, executable_path, command_prefix=None): 23 def __init__(self, executable_path, command_prefix=None):
24 self.executable_path = executable_path 24 self.executable_path = executable_path
25 self.command_prefix = command_prefix if command_prefix else [] 25 self.command_prefix = command_prefix if command_prefix else []
26 26
27 @overrides(Shell) 27 @overrides(Shell)
28 def serve_local_directory(self, local_dir_path, port=0, free_host_port=False):
29 mappings = [('', [local_dir_path])]
30 return 'http://%s:%d/' % http_server.start_http_server(mappings, port)
31
32 @overrides(Shell)
33 def serve_local_directories(self, mappings, port=0, free_host_port=False): 28 def serve_local_directories(self, mappings, port=0, free_host_port=False):
34 return 'http://%s:%d/' % http_server.start_http_server(mappings, port) 29 return 'http://%s:%d/' % http_server.start_http_server(mappings, port)
35 30
36 @overrides(Shell) 31 @overrides(Shell)
37 def forward_host_port_to_shell(self, host_port): 32 def forward_host_port_to_shell(self, host_port):
38 pass 33 pass
39 34
40 @overrides(Shell) 35 @overrides(Shell)
41 def run(self, arguments): 36 def run(self, arguments):
42 command = self.command_prefix + [self.executable_path] + arguments 37 command = self.command_prefix + [self.executable_path] + arguments
(...skipping 10 matching lines...) Expand all
53 wait_thread.join(timeout) 48 wait_thread.join(timeout)
54 49
55 did_time_out = False 50 did_time_out = False
56 if p.poll() is None: 51 if p.poll() is None:
57 did_time_out = True 52 did_time_out = True
58 p.terminate() 53 p.terminate()
59 p.poll() 54 p.poll()
60 output_file.seek(0) 55 output_file.seek(0)
61 output = output_file.read() 56 output = output_file.read()
62 return p.returncode, output, did_time_out 57 return p.returncode, output, did_time_out
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