diff --git a/raven/transport/threaded.py b/raven/transport/threaded.py index c2f108880..2b3cda761 100644 --- a/raven/transport/threaded.py +++ b/raven/transport/threaded.py @@ -11,6 +11,7 @@ import logging import threading import os +import sys from time import sleep, time @@ -64,18 +65,20 @@ def main_thread_terminated(self): if not self._timed_queue_join(initial_timeout): # if that didn't work, wait a bit longer - # NB that size is an approximation, because other threads may - # add or remove items - size = self._queue.qsize() - - print("Sentry is attempting to send %i pending error messages" - % size) - print("Waiting up to %s seconds" % timeout) - - if os.name == 'nt': - print("Press Ctrl-Break to quit") - else: - print("Press Ctrl-C to quit") + + if sys.stdin.isatty() and sys.stdout.isatty(): + # NB that size is an approximation, because other threads + # may add or remove items + size = self._queue.qsize() + + print("Sentry is attempting to send %i " + "pending error messages" % size) + print("Waiting up to %s seconds" % timeout) + + if os.name == 'nt': + print("Press Ctrl-Break to quit") + else: + print("Press Ctrl-C to quit") self._timed_queue_join(timeout - initial_timeout)