Skip to content

Honcho 2.0.0 Compatibility Issues on Windows #254

@Xdynix

Description

@Xdynix

Hello, it seems that honcho isn't working on Windows. Below is the experiment script I used.

main.py
import os
import time
from contextlib import contextmanager, suppress
from pathlib import Path


@contextmanager
def pid_file():
    pid = os.getpid()
    file_path = Path(f"{pid}.txt")
    file_path.write_text(f"Process ID file for PID {pid}\n")
    print(f"Created file: {file_path.name}")
    try:
        yield file_path
    finally:
        if file_path.exists():
            file_path.unlink()
            print(f"Deleted file: {file_path.name}")


def main():
    with suppress(KeyboardInterrupt), pid_file():
        print("Running.")
        while True:
            time.sleep(0.1)


if __name__ == "__main__":
    main()
Procfile
proc1: python main.py
proc2: python main.py

The expected behavior after pressing Ctrl + C is as follows:

$ python main.py
Created file: 31092.txt
Running.
Deleted file: 31092.txt

However, when using honcho, the following error appears, and the child processes do not terminate even after forcefully closing the terminal.

Console Output
$ honcho start
20:00:24 system  | proc1.1 started (pid=26932)
20:00:24 system  | proc2.1 started (pid=31584)
20:00:26 system  | SIGINT received
20:00:26 system  | sending SIGTERM to proc1.1 (pid 26932)
20:00:26 system  | sending SIGTERM to proc2.1 (pid 31584)
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main                                                                                                                                                           
  File "<frozen runpy>", line 88, in _run_code                                                                                                                                                                      
  File "V:\Workplace\Playground\.venv\Scripts\honcho.exe\__main__.py", line 10, in <module>                                                                                                                         
    sys.exit(main())
             ~~~~^^
  File "V:\Workplace\Playground\.venv\Lib\site-packages\honcho\command.py", line 318, in main                                                                                                                       
    COMMANDS[args.command](args)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "V:\Workplace\Playground\.venv\Lib\site-packages\honcho\command.py", line 254, in command_start                                                                                                              
    manager.loop()
    ~~~~~~~~~~~~^^
  File "V:\Workplace\Playground\.venv\Lib\site-packages\honcho\manager.py", line 110, in loop                                                                                                                       
    msg = self.events.get(timeout=0.1)
  File "C:\Users\me\AppData\Roaming\uv\python\cpython-3.13.2-windows-x86_64-none\Lib\multiprocessing\queues.py", line 111, in get                                                                                
    if not self._poll(timeout):
           ~~~~~~~~~~^^^^^^^^^
  File "C:\Users\me\AppData\Roaming\uv\python\cpython-3.13.2-windows-x86_64-none\Lib\multiprocessing\connection.py", line 257, in poll                                                                           
    return self._poll(timeout)
           ~~~~~~~~~~^^^^^^^^^
  File "C:\Users\me\AppData\Roaming\uv\python\cpython-3.13.2-windows-x86_64-none\Lib\multiprocessing\connection.py", line 346, in _poll                                                                          
    return bool(wait([self], timeout))
                ~~~~^^^^^^^^^^^^^^^^^
  File "C:\Users\me\AppData\Roaming\uv\python\cpython-3.13.2-windows-x86_64-none\Lib\multiprocessing\connection.py", line 1096, in wait                                                                          
    ready_handles = _exhaustive_wait(waithandle_to_obj.keys(), timeout)
  File "C:\Users\me\AppData\Roaming\uv\python\cpython-3.13.2-windows-x86_64-none\Lib\multiprocessing\connection.py", line 1028, in _exhaustive_wait                                                              
    res = _winapi.WaitForMultipleObjects(short_L, False, timeout)
InterruptedError: [Errno 4] Interrupted function call

Python: 3.13.2
Honcho: 2.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions