Fix some comments and use of [] as a default arg

Signed-off-by: Jack Andersen <johnandersen185@gmail.com>
This commit is contained in:
Jack Andersen 2021-04-07 16:43:09 -04:00
parent ad3f427f9f
commit a586b9b05d
3 changed files with 5 additions and 3 deletions

View File

@ -83,7 +83,7 @@ def send(colors, cache_dir=CACHE_DIR, to_send=True,
# Writing to "/dev/pts/[0-9] lets you send data to open terminals.
if to_send:
ttys = []
ttys = None
if only_active:
ttys = util.fetch_active_ttys()

View File

@ -13,7 +13,7 @@ import os
import platform
__version__ = "3.3.1"
__version__ = "3.3.2"
__cache_version__ = "1.1.0"

View File

@ -134,7 +134,7 @@ def save_file(data, export_file):
logging.warning("Couldn't write to %s.", export_file)
def save_to_tty(data, tty_name, active_ttys=[]):
def save_to_tty(data, tty_name, active_ttys=None):
"""Write data to a tty."""
if active_ttys:
if os.path.basename(tty_name) not in active_ttys:
@ -144,6 +144,8 @@ def save_to_tty(data, tty_name, active_ttys=[]):
def fetch_active_ttys():
"""Fetches the active ttys as determined
by the `who` utility. On failure, we return None."""
try:
out, err = subprocess.Popen(
["who"], stdout=subprocess.PIPE).communicate()