Skip to content
Merged
Changes from all 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
14 changes: 9 additions & 5 deletions src/mcpm/commands/share.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ def find_mcp_proxy() -> Optional[str]:

def make_non_blocking(file_obj):
"""Make a file object non-blocking."""
import fcntl

fd = file_obj.fileno()
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
if os.name == 'posix':
import fcntl

fd = file_obj.fileno()
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
# On other platforms (e.g., Windows), we rely on the behavior of select()
# and the non-blocking nature of readline() on Popen streams,
# or the existing try-except for IOError/OSError.


def wait_for_random_port(process: subprocess.Popen, timeout: int = 20) -> Optional[int]:
Expand Down