From a03f4f0b2585081b701a211bc50f30fc75a95df5 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Mon, 18 Feb 2019 21:23:37 -0500 Subject: [PATCH] Catch error and typo fix --- rtv/terminal.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rtv/terminal.py b/rtv/terminal.py index 4a4ede8..2b8d3d2 100644 --- a/rtv/terminal.py +++ b/rtv/terminal.py @@ -590,7 +590,7 @@ class Terminal(object): # by RTV. It's also safer because it doesn't inject # python code through the command line. - # Surpress stdout/stderr from the browser, see + # Suppress stdout/stderr from the browser, see # https://stackoverflow.com/questions/2323080. We can't # depend on replacing sys.stdout & sys.stderr because # webbrowser uses Popen(). @@ -601,7 +601,10 @@ class Terminal(object): os.dup2(null, 2) webbrowser.open_new_tab(url) finally: - null.close() + try: + null.close() + except AttributeError: + pass os.dup2(stdout, 1) os.dup2(stderr, 2)