Repository: asciinema/asciinema (language: rust)

Issue:
Alpine Crash "FileNotFoundError: [Errno 2] No such file or directory: 'tput'"
$ cat /etc/os-release
```
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.11.3
PRETTY_NAME="Alpine Linux v3.11"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
```

$ asciinema rec
```
asciinema: recording asciicast to /tmp/tmpoa7wg6xn-ascii.cast
asciinema: press <ctrl-d> or type "exit" when you're done
Traceback (most recent call last):
  File "/usr/bin/asciinema", line 11, in <module>
    load_entry_point('asciinema==2.0.2', 'console_scripts', 'asciinema')()
  File "/usr/lib/python3.8/site-packages/asciinema/__main__.py", line 131, in main
    code = command.execute()
  File "/usr/lib/python3.8/site-packages/asciinema/commands/record.py", line 69, in execute
    asciinema.record_asciicast(
  File "/usr/lib/python3.8/site-packages/asciinema/__init__.py", line 33, in record_asciicast
    w, h = term.get_size()
  File "/usr/lib/python3.8/site-packages/asciinema/term.py", line 35, in get_size
    int(subprocess.check_output(['tput', 'cols'])),
  File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 489, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'tput'
```


Discussion / hints:

Fix patch:
diff --git a/asciinema/term.py b/asciinema/term.py
index c1b6dfadd..f3b54fb9f 100644
--- a/asciinema/term.py
+++ b/asciinema/term.py
@@ -33,8 +33,10 @@ def read_blocking(fd, timeout):
 
 
 def get_size():
-    # TODO maybe use os.get_terminal_size ?
-    return (
-        int(subprocess.check_output(['tput', 'cols'])),
-        int(subprocess.check_output(['tput', 'lines']))
-    )
+    try:
+        return os.get_terminal_size()
+    except:
+        return (
+            int(subprocess.check_output(['tput', 'cols'])),
+            int(subprocess.check_output(['tput', 'lines']))
+        )


Test patch: