File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,8 @@ def router():
8686
8787@router .command (name = "on" )
8888@click .help_option ("-h" , "--help" )
89- def start_router ():
89+ @click .option ("--verbose" , "-v" , is_flag = True , help = "Enable verbose output" )
90+ def start_router (verbose ):
9091 """Start MCPRouter as a daemon process.
9192
9293 Example:
@@ -128,13 +129,25 @@ def start_router():
128129 # open log file, prepare to redirect stdout and stderr
129130 with open (log_file , "a" ) as log :
130131 # use subprocess.Popen to start uvicorn
132+ start = log .tell ()
131133 process = subprocess .Popen (
132134 uvicorn_cmd ,
133135 stdout = log ,
134136 stderr = log ,
135137 env = os .environ .copy (),
136138 start_new_session = True , # create new session, so the process won't be affected by terminal closing
137139 )
140+ if verbose :
141+ with open (log_file , "r" ) as log :
142+ # print log before startup complete
143+ log .seek (start )
144+ while True :
145+ line = log .readline ()
146+ if not line :
147+ continue
148+ console .print (line .strip ())
149+ if "Application startup complete." in line :
150+ break
138151
139152 # record PID
140153 pid = process .pid
You can’t perform that action at this time.
0 commit comments