Skip to content

Commit

Permalink
win fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ltdrdata committed May 21, 2024
1 parent 304201c commit d88f790
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions comfy_cli/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ def msg_hook(stream):

while True:
line = stream.readline()

if "Launching ComfyUI from:" in line:
logging_flag = True
elif "To see the GUI go to:" in line:
Expand Down Expand Up @@ -527,21 +526,33 @@ def redirector_stderr():
def redirector_stdout():
while True:
if process is not None:
print(process.stderr.readline(), end="")
print(process.stdout.readline(), end="")

t1 = threading.Thread(target=redirector_stderr).start()
t2 = threading.Thread(target=redirector_stdout).start()

try:
while True:
process = subprocess.Popen(
[sys.executable, "main.py"] + extra,
text=True,
env=new_env,
encoding="utf-8",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
if sys.platform == "win32":
process = subprocess.Popen(
[sys.executable, "main.py"] + extra,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
env=new_env,
encoding="utf-8",
shell=True, # win32 only
creationflags=subprocess.CREATE_NEW_PROCESS_GROUP, # win32 only
)
else:
process = subprocess.Popen(
[sys.executable, "main.py"] + extra,
text=True,
env=new_env,
encoding="utf-8",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)

process.wait()

Expand Down

0 comments on commit d88f790

Please sign in to comment.