Commits

Christian Ebert  committed 656e82c

util: reduce number of term and screen checks

Set default keyword arguments for notty and screen to None
in util.systemcall: no extra checking when they are given
as False.

  • Participants
  • Parent commits 06b334f

Comments (0)

Files changed (1)

File muttils/util.py

         return ''
     return os.path.splitext(os.path.basename(prog))[0]
 
-def systemcall(cs, notty=False, screen=False):
+def systemcall(cs, notty=None, screen=None):
     '''Calls command sequence cs in manner suiting
     terminal connectivity.'''
     # programs that can be launched without terminal connection
     termprogs = 'w3m', 'wget'
     prog = progname(cs[0])
-    # check if connected to terminal
-    notty = notty or prog not in termprogs and not termconnected()
-    # are we inside a screen session
-    screen = screen or prog not in termprogs[1:] and 'STY' in os.environ
+    if notty is None:
+        # check if connected to terminal
+        notty = prog not in termprogs and not termconnected()
+    if screen is None:
+        # w3m behaves differently in screen
+        screen = prog not in termprogs[1:] and 'STY' in os.environ
     try:
         if notty and not screen:
             tty = os.ctermid()