From d3804f27c7fd3b3ecfb933050b05af91374051a2 Mon Sep 17 00:00:00 2001 From: Brian Abbott Date: Sun, 5 Jan 2025 01:42:51 -0800 Subject: [PATCH] resolved termios error during execution on a windows environment --- llama_stack/distribution/utils/exec.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/llama_stack/distribution/utils/exec.py b/llama_stack/distribution/utils/exec.py index 7b06e384d..e7d9708e3 100644 --- a/llama_stack/distribution/utils/exec.py +++ b/llama_stack/distribution/utils/exec.py @@ -7,16 +7,24 @@ import errno import logging import os -import pty import select import signal import subprocess import sys -import termios log = logging.getLogger(__name__) +# Handle Windows-specific code or import alternative modules if needed +# For example, you could use the msvcrt module for some functionalities +# that are similar to termios. +if sys.platform.startswith('win'): + import msvcrt +else: + # Unix-specific code here + import pty + import termios +# Rest of your code that uses termios or msvcrt on Windows # run a command in a pseudo-terminal, with interrupt handling, # useful when you want to run interactive things def run_with_pty(command):