mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-05 10:13:05 +00:00
resolved termios error during execution on a windows environment
This commit is contained in:
parent
e86271aeac
commit
d3804f27c7
1 changed files with 10 additions and 2 deletions
|
@ -7,16 +7,24 @@
|
||||||
import errno
|
import errno
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import pty
|
|
||||||
import select
|
import select
|
||||||
import signal
|
import signal
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import termios
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
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,
|
# run a command in a pseudo-terminal, with interrupt handling,
|
||||||
# useful when you want to run interactive things
|
# useful when you want to run interactive things
|
||||||
def run_with_pty(command):
|
def run_with_pty(command):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue