fix: invoke uvicorn via sys.executable to handle sudo PATH restrictions
This commit is contained in:
@@ -351,19 +351,20 @@ def deploy(
|
|||||||
|
|
||||||
if api and not dry_run:
|
if api and not dry_run:
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
console.print(f"[green]Starting DECNET API on port {api_port}...[/]")
|
console.print(f"[green]Starting DECNET API on port {api_port}...[/]")
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env["DECNET_INGEST_LOG_FILE"] = effective_log_file
|
env["DECNET_INGEST_LOG_FILE"] = effective_log_file
|
||||||
try:
|
try:
|
||||||
subprocess.Popen(
|
subprocess.Popen(
|
||||||
["uvicorn", "decnet.web.api:app", "--host", "0.0.0.0", "--port", str(api_port)],
|
[sys.executable, "-m", "uvicorn", "decnet.web.api:app", "--host", "0.0.0.0", "--port", str(api_port)],
|
||||||
env=env,
|
env=env,
|
||||||
stdout=subprocess.DEVNULL,
|
stdout=subprocess.DEVNULL,
|
||||||
stderr=subprocess.STDOUT
|
stderr=subprocess.STDOUT
|
||||||
)
|
)
|
||||||
console.print(f"[dim]API running at http://0.0.0.0:{api_port}[/]")
|
console.print(f"[dim]API running at http://0.0.0.0:{api_port}[/]")
|
||||||
except FileNotFoundError:
|
except (FileNotFoundError, subprocess.SubprocessError):
|
||||||
console.print("[red]Failed to start API: 'uvicorn' not found. Is it installed?[/]")
|
console.print("[red]Failed to start API. Ensure 'uvicorn' is installed in the current environment.[/]")
|
||||||
|
|
||||||
|
|
||||||
@app.command()
|
@app.command()
|
||||||
|
|||||||
Reference in New Issue
Block a user