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

Unified Diff: sky/tools/skydb

Issue 682153003: Add a sky_server for running sky apps (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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
« sky/tools/sky_server ('K') | « sky/tools/sky_server ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/tools/skydb
diff --git a/sky/tools/skydb b/sky/tools/skydb
index 2273800286e4e77fa270be7aac86d5f19becd597..cfe1996ce640269610477815948e521b47e5a6ec 100755
--- a/sky/tools/skydb
+++ b/sky/tools/skydb
@@ -12,7 +12,8 @@ import urlparse
BUILD_DIRECTORY = 'out'
CONFIG_DIRECTORY = 'Debug'
-MOJO_SHELL_PATH = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir,
+SKY_TOOLS_DIRECTORY = os.path.abspath(os.path.join(__file__, os.pardir))
+MOJO_SHELL_PATH = os.path.abspath(os.path.join(SKY_TOOLS_DIRECTORY, os.pardir,
os.pardir, BUILD_DIRECTORY, CONFIG_DIRECTORY, 'mojo_shell'))
SUPPORTED_MIME_TYPES = [
@@ -23,14 +24,12 @@ SUPPORTED_MIME_TYPES = [
def start_http_server_for_file(path):
HTTP_PORT = 9999
- directory = os.path.dirname(os.path.abspath(path))
server_command = [
- 'python',
- '-m',
- 'SimpleHTTPServer',
- str(HTTP_PORT)
+ os.path.join(SKY_TOOLS_DIRECTORY, 'sky_server'),
+ os.path.dirname(os.path.abspath(path)),
+ str(HTTP_PORT),
]
- subprocess.Popen(server_command, cwd=directory)
+ subprocess.Popen(server_command)
return 'http://localhost:%s/%s' % (HTTP_PORT, os.path.basename(path))
@@ -64,4 +63,7 @@ def main():
if __name__ == '__main__':
- main()
+ try:
+ main()
+ except (KeyboardInterrupt, SystemExit):
+ print "Quitting"
« sky/tools/sky_server ('K') | « sky/tools/sky_server ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698