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

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

Issue 1259793008: Support dev servers defined in a mojoconfig file. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address Ben's comments. Created 5 years, 4 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
« no previous file with comments | « no previous file | mojo/devtools/common/devtoolslib/shell_arguments.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 atexit 5 import atexit
6 import datetime 6 import datetime
7 import email.utils 7 import email.utils
8 import errno 8 import errno
9 import gzip 9 import gzip
10 import hashlib 10 import hashlib
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 assert mappings 196 assert mappings
197 handler_class = _get_handler_class_for_path(mappings) 197 handler_class = _get_handler_class_for_path(mappings)
198 198
199 try: 199 try:
200 httpd = _SilentTCPServer(('127.0.0.1', host_port), handler_class) 200 httpd = _SilentTCPServer(('127.0.0.1', host_port), handler_class)
201 atexit.register(httpd.shutdown) 201 atexit.register(httpd.shutdown)
202 202
203 http_thread = threading.Thread(target=httpd.serve_forever) 203 http_thread = threading.Thread(target=httpd.serve_forever)
204 http_thread.daemon = True 204 http_thread.daemon = True
205 http_thread.start() 205 http_thread.start()
206 print 'Started http://%s:%d to host %s.' % (httpd.server_address[0],
207 httpd.server_address[1],
208 str(mappings))
209 return httpd.server_address 206 return httpd.server_address
210 except socket.error as v: 207 except socket.error as v:
211 error_code = v[0] 208 error_code = v[0]
212 print 'Failed to start http server for %s on port %d: %s.' % ( 209 print 'Failed to start http server for %s on port %d: %s.' % (
213 str(mappings), host_port, os.strerror(error_code)) 210 str(mappings), host_port, os.strerror(error_code))
214 if error_code == errno.EADDRINUSE: 211 if error_code == errno.EADDRINUSE:
215 print (' Run `fuser %d/tcp` to find out which process is using the port.' 212 print (' Run `fuser %d/tcp` to find out which process is using the port.'
216 % host_port) 213 % host_port)
217 print '---' 214 print '---'
218 raise 215 raise
OLDNEW
« no previous file with comments | « no previous file | mojo/devtools/common/devtoolslib/shell_arguments.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698