morshu-server: fix startup by passing env and using sys.executable
This commit is contained in:
+6
-1
@@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import shutil
|
import shutil
|
||||||
import logging
|
import logging
|
||||||
import asyncio
|
import asyncio
|
||||||
@@ -527,10 +528,14 @@ class TtsToy(Cog):
|
|||||||
log.error(f"Morshu server not found: {server_py}")
|
log.error(f"Morshu server not found: {server_py}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
env = os.environ.copy()
|
||||||
|
env['PORT'] = str(self.morshu_port)
|
||||||
|
|
||||||
self.morshu_process = await asyncio.to_thread(
|
self.morshu_process = await asyncio.to_thread(
|
||||||
subprocess.Popen,
|
subprocess.Popen,
|
||||||
["python3", "server.py"],
|
[sys.executable, "server.py"],
|
||||||
cwd=str(self.morshu_dir),
|
cwd=str(self.morshu_dir),
|
||||||
|
env=env,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
text=True
|
text=True
|
||||||
|
|||||||
Reference in New Issue
Block a user