@@ -69,10 +69,6 @@ def IsInteractive(output=False, error=False, heuristic=False):
6969 return True
7070
7171
72- def PreexecFunc ():
73- signal .signal (signal .SIGINT , signal .SIG_IGN )
74-
75-
7672def More (contents , out , prompt = None , check_pager = True ):
7773 """Run a user specified pager or fall back to the internal pager.
7874
@@ -102,18 +98,14 @@ def More(contents, out, prompt=None, check_pager=True):
10298 less_orig = encoding .GetEncodedValue (os .environ , 'LESS' , None )
10399 less = '-R' + (less_orig or '' )
104100 encoding .SetEncodedValue (os .environ , 'LESS' , less )
105- # Ignores SIGINT from this point on since the child process has started
106- # and we don't want to terminate either one when the child is still alive.
101+ # Ignore SIGINT while the pager is running.
102+ # We don't want to terminate the parent while the child is still alive.
107103 signal .signal (signal .SIGINT , signal .SIG_IGN )
108- # Runs PreexecFunc before starting the child so SIGINT is ignored for the
109- # child process as well.
110- p = subprocess .Popen (
111- pager , stdin = subprocess .PIPE , shell = True , preexec_fn = PreexecFunc )
104+ p = subprocess .Popen (pager , stdin = subprocess .PIPE , shell = True )
112105 enc = console_attr .GetConsoleAttr ().GetEncoding ()
113106 p .communicate (input = contents .encode (enc ))
114107 p .wait ()
115- # Starts using default disposition for SIGINT again after the child has
116- # exited.
108+ # Start using default signal handling for SIGINT again.
117109 signal .signal (signal .SIGINT , signal .SIG_DFL )
118110 if less_orig is None :
119111 encoding .SetEncodedValue (os .environ , 'LESS' , None )
0 commit comments