MCPcopy
hub / github.com/HKUDS/DeepCode / start_frontend

Function start_frontend

deepcode.py:260–290  ·  view source on GitHub ↗

Start the frontend dev server

(frontend_dir: Path)

Source from the content-addressed store, hash-verified

258
259
260def start_frontend(frontend_dir: Path):
261 """Start the frontend dev server"""
262 global _frontend_process
263
264 print("🎨 Starting frontend server...")
265
266 npm_cmd = "npm.cmd" if get_platform() == "windows" else "npm"
267
268 if get_platform() == "windows":
269 _frontend_process = subprocess.Popen(
270 f"{npm_cmd} run dev",
271 cwd=frontend_dir,
272 shell=True,
273 creationflags=subprocess.CREATE_NEW_PROCESS_GROUP,
274 )
275 else:
276 _frontend_process = subprocess.Popen(
277 [npm_cmd, "run", "dev"],
278 cwd=frontend_dir,
279 start_new_session=True, # Create new process group
280 )
281
282 # Wait for frontend to start
283 time.sleep(3)
284
285 if _frontend_process.poll() is None:
286 print("✅ Frontend started: http://localhost:5173")
287 return True
288 else:
289 print("❌ Frontend failed to start")
290 return False
291
292
293def cleanup_processes():

Callers 1

mainFunction · 0.85

Calls 1

get_platformFunction · 0.85

Tested by

no test coverage detected