File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env node
2+
3+ /**
4+ * Simple http server implementation.
5+ * Optionally, you may set `DEBUG_BROWSER` environment variable to use a different browser to debug
6+ * web apps.
7+ */
8+
29import * as http from 'http'
310import * as path from 'path'
411import * as fs from 'fs'
@@ -9,6 +16,7 @@ import * as logging from 'lib0/logging'
916const host = env . getParam ( '--host' , 'localhost' )
1017const port = number . parseInt ( env . getParam ( '--port' , '8000' ) )
1118const paramOpenFile = env . getParam ( '-o' , '' )
19+ const debugBrowser = env . getConf ( 'DEBUG_BROWSER' )
1220
1321/**
1422 * @type {Object<string,string> }
@@ -81,7 +89,7 @@ const server = http.createServer((req, res) => {
8189server . listen ( port , host , ( ) => {
8290 logging . print ( logging . BOLD , logging . ORANGE , `Server is running on http://${ host } :${ port } ` )
8391 if ( paramOpenFile ) {
84- const start = process . platform === 'darwin' ? 'open' : process . platform === 'win32' ? 'start' : 'xdg-open'
92+ const start = debugBrowser || ( process . platform === 'darwin' ? 'open' : process . platform === 'win32' ? 'start' : 'xdg-open' )
8593 import ( 'child_process' ) . then ( cp => {
8694 cp . exec ( `${ start } http://${ host } :${ port } /${ paramOpenFile } ` )
8795 } )
You can’t perform that action at this time.
0 commit comments