From 728cbe4535e49661b404b15a3182dd36ca4514e9 Mon Sep 17 00:00:00 2001 From: Peter Brittain Date: Sun, 17 Sep 2023 10:29:42 +0100 Subject: [PATCH] Attempt to let curses run despite no tty --- .github/workflows/test.yml | 2 -- asciimatics/screen.py | 6 +++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7300ddf..92e4e26 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,8 +18,6 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - sudo apt-get update -qq - sudo apt list --installed python -m pip install --upgrade pip pip install -r requirements/dev.txt - name: Test diff --git a/asciimatics/screen.py b/asciimatics/screen.py index 8686e46..dd6d4b3 100644 --- a/asciimatics/screen.py +++ b/asciimatics/screen.py @@ -1369,7 +1369,11 @@ def open(cls, height=None, catch_interrupt=False, unicode_aware=None): # Reproduce curses.wrapper() stdscr = curses.initscr() curses.noecho() - curses.cbreak() + # Shouldn't fail on real systems. This code is for running tests in CI pipelines. + try: + curses.cbreak() + except curses.error: + pass stdscr.keypad(1) # Fed up with linters complaining about original curses code - trying to be a bit better...