Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve problems on Windows running the sub processes when in editable mode #18379

Merged
merged 4 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion chia/cmds/start_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import asyncio
import os
import shutil
import subprocess
import sys
from concurrent.futures import ThreadPoolExecutor
Expand All @@ -21,8 +22,13 @@ def launch_start_daemon(root_path: Path) -> subprocess.Popen:
if sys.platform == "win32":
creationflags = subprocess.CREATE_NEW_PROCESS_GROUP | subprocess.CREATE_NO_WINDOW

path_helper: Path = Path(sys.argv[0])
cmd_to_execute = shutil.which(cmd=path_helper.name, path=path_helper.parent)
if cmd_to_execute is None:
cmd_to_execute = sys.argv[0]

process = subprocess.Popen(
[sys.argv[0], "run_daemon", "--wait-for-unlock"],
[cmd_to_execute, "run_daemon", "--wait-for-unlock"],
encoding="utf-8",
stdout=subprocess.PIPE,
creationflags=creationflags,
Expand Down
4 changes: 3 additions & 1 deletion chia/daemon/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import json
import logging
import os
import shutil
import signal
import ssl
import subprocess
Expand Down Expand Up @@ -112,7 +113,8 @@ def executable_for_service(service_name: str) -> str:
application_path = os.path.dirname(__file__)

def executable_for_service(service_name: str) -> str:
return service_name
cmd_to_exec = shutil.which(service_name)
return cmd_to_exec if cmd_to_exec is not None else service_name


async def ping() -> Dict[str, Any]:
Expand Down
Loading