summaryrefslogtreecommitdiffstats
path: root/helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'helpers.py')
-rw-r--r--helpers.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/helpers.py b/helpers.py
index e43eea2..8793417 100644
--- a/helpers.py
+++ b/helpers.py
@@ -4,9 +4,14 @@ logprefix = ''
verbose = 0
def log(s):
- sys.stdout.flush()
- sys.stderr.write(logprefix + s)
- sys.stderr.flush()
+ try:
+ sys.stdout.flush()
+ sys.stderr.write(logprefix + s)
+ sys.stderr.flush()
+ except IOError:
+ # this could happen if stderr gets forcibly disconnected, eg. because
+ # our tty closes. That sucks, but it's no reason to abort the program.
+ pass
def debug1(s):
if verbose >= 1: