Skip to content

Commit

Permalink
fix: fixed error when /dev/tty cannot be opened (such as in CI)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Nov 5, 2023
1 parent e94f7f6 commit aaf5d9e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gptme/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,13 @@ def main(

# Attempt to switch to interactive mode
sys.stdin.close()
sys.stdin = open("/dev/tty")
try:
sys.stdin = open("/dev/tty")
except OSError:
# if we can't open /dev/tty, we're probably in a CI environment, so we should just continue
logger.warning(
"Failed to switch to interactive mode, continuing in non-interactive mode"
)

# we need to run this before checking stdin, since the interactive doesn't work with the switch back to interactive mode
logfile = get_logfile(
Expand Down

0 comments on commit aaf5d9e

Please sign in to comment.