[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [nyx/master] Set environment variables inline



commit 2a621aeb8838117b7c65ad1932dc37bc223caf43
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun Sep 10 03:42:56 2017 -0700

    Set environment variables inline
    
    Shortening the starter a bit by dropping a couple helpers. No need to be quite
    so verbose.
---
 nyx/starter.py | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/nyx/starter.py b/nyx/starter.py
index 90aa947..40cfc6b 100644
--- a/nyx/starter.py
+++ b/nyx/starter.py
@@ -78,11 +78,12 @@ def main(config):
   _warn_if_root(controller)
   _warn_if_unable_to_get_pid(controller)
   _warn_about_unused_config_keys()
-  _use_english_subcommands()
-  _use_no_esc_delay()
   _use_unicode()
   _set_process_name()
 
+  os.putenv('LANG', 'C')  # make subcommands (ps, netstat, etc) provide english results
+  os.putenv('ESCDELAY', '0')  # make 'esc' take effect right away
+
   try:
     nyx.curses.start(nyx.draw_loop, acs_support = config.get('acs_support', True), transparent_background = True, cursor = False)
   except KeyboardInterrupt:
@@ -182,25 +183,6 @@ def _warn_about_unused_config_keys(config):
       stem.util.log.notice('Unused configuration entry: %s' % key)
 
 
-def _use_english_subcommands():
-  """
-  Make subcommands we run (ps, netstat, etc) provide us with English results.
-  This is important so we can parse the output.
-  """
-
-  os.putenv('LANG', 'C')
-
-
-def _use_no_esc_delay():
-  """
-  Make it so pressing 'esc' takes effect right away...
-
-    https://stackoverflow.com/questions/27372068/why-does-the-escape-key-have-a-delay-in-python-curses/28020568#28020568
-  """
-
-  os.putenv('ESCDELAY', '0')
-
-
 @uses_settings
 def _use_unicode(config):
   """



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits