MCPcopy Create free account
hub / github.com/csound/csound / main

Function main

Emscripten/examples/httpd.py:281–306  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

279
280
281def main(args):
282 parser = optparse.OptionParser()
283 parser.add_option('-C', '--serve-dir',
284 help='Serve files out of this directory.',
285 dest='serve_dir', default=os.path.abspath('.'))
286 parser.add_option('-p', '--port',
287 help='Run server on this port.',
288 dest='port', default=5103)
289 parser.add_option('--no_dir_check',
290 help='No check to ensure serving from safe directory.',
291 dest='do_safe_check', action='store_false', default=True)
292 parser.add_option('--test-mode',
293 help='Listen for posts to /ok or /fail and shut down the server with '
294 ' errorcodes 0 and 1 respectively.',
295 dest='test_mode', action='store_true')
296 options, args = parser.parse_args(args)
297 if options.do_safe_check:
298 SanityCheckDirectory(options.serve_dir)
299
300 server = LocalHTTPServer(options.serve_dir, int(options.port),
301 options.test_mode)
302
303 # Serve until the client tells us to stop. When it does, it will give us an
304 # errorcode.
305 print 'Serving %s on %s...' % (options.serve_dir, server.GetURL(''))
306 return server.ServeForever()
307
308if __name__ == '__main__':
309 sys.exit(main(sys.argv[1:]))

Callers 1

httpd.pyFile · 0.70

Calls 4

GetURLMethod · 0.95
ServeForeverMethod · 0.95
SanityCheckDirectoryFunction · 0.85
LocalHTTPServerClass · 0.85

Tested by

no test coverage detected