Switch tests to headless mode if no TTY detected

develop
lethosor 2020-03-28 13:18:31 -04:00
parent 6eb73d9046
commit 1c39ed1428
1 changed files with 4 additions and 0 deletions

@ -17,6 +17,10 @@ parser.add_argument('--no-quit', action='store_true',
help='Do not quit DF when done')
args = parser.parse_args()
if (not sys.stdin.isatty() or not sys.stdout.isatty() or not sys.stderr.isatty()) and not args.headless:
print('WARN: no TTY detected, enabling headless mode')
args.headless = True
MAX_TRIES = 5
dfhack = 'Dwarf Fortress.exe' if sys.platform == 'win32' else './dfhack'