Skip to content

Commit

Permalink
CHIA-1084: Address some problems launching the daemon from the GUI on…
Browse files Browse the repository at this point in the history
… Windows (#18427)

* Add some prints to launch_start_daemon

* don't use shutil.which when already have file extension

* bad code is bad

* Adjust prints

* black fix

* Cleanup code with single print
  • Loading branch information
emlowe authored Aug 12, 2024
1 parent d1464da commit 3d0bc95
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions chia/cmds/start_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ def launch_start_daemon(root_path: Path) -> subprocess.Popen:
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)
cmd_to_execute = None
if len(path_helper.suffix) == 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]

print(f"Starting daemon: {cmd_to_execute} run_daemon --wait-for-unlock", flush=True)
process = subprocess.Popen(
[cmd_to_execute, "run_daemon", "--wait-for-unlock"],
encoding="utf-8",
Expand All @@ -42,7 +46,7 @@ async def create_start_daemon_connection(
) -> Optional[DaemonProxy]:
connection = await connect_to_daemon_and_validate(root_path, config)
if connection is None:
print("Starting daemon")
print("Starting daemon", flush=True)
# launch a daemon
process = launch_start_daemon(root_path)
# give the daemon a chance to start up
Expand Down

0 comments on commit 3d0bc95

Please sign in to comment.