[tor-commits] [ooni-probe/master] When stdin is not attached to a tty exit early

art at torproject.org art at torproject.org
Fri Jan 13 12:39:57 UTC 2017


commit ea12da31eceb3c79b259da5edb562a282022a7d8
Author: Arturo Filastò <arturo at filasto.net>
Date:   Fri Oct 28 19:24:34 2016 +0200

    When stdin is not attached to a tty exit early
---
 ooni/ui/cli.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ooni/ui/cli.py b/ooni/ui/cli.py
index 6228d2f..c545d82 100644
--- a/ooni/ui/cli.py
+++ b/ooni/ui/cli.py
@@ -174,6 +174,10 @@ def director_startup_other_failures(failure):
 
 def initializeOoniprobe(global_options):
     print("It looks like this is the first time you are running ooniprobe")
+    if not sys.stdin.isatty():
+        print("ERROR: STDIN is not attached to a tty. Quiting.")
+        sys.exit(8)
+
     print("Please take a minute to read through the informed consent documentation and "
           "understand what are the risks associated with running ooniprobe.")
     print("Press enter to continue...")





More information about the tor-commits mailing list