Skip to content

Commit ea39489

Browse files
committed
Moved indentation and added clarifying comments
1 parent c9a9235 commit ea39489

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cmd2/cmd2.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,9 @@ def __init__(self, completekey: str = 'tab', stdin=None, stdout=None, persistent
436436
# A flag used to protect critical sections in the main thread from stopping due to a KeyboardInterrupt
437437
self.sigint_protection = utils.ContextFlag()
438438

439-
# When this is not None, then it holds a ProcReader for the pipe process created by the current command
439+
# If the current command created a process to pipe to, then this will be a ProcReader object.
440+
# Otherwise the value will be None. This member is used to know when a pipe process can be killed
441+
# and also waited upon.
440442
self.cur_pipe_proc_reader = None
441443

442444
# Used by complete() for readline tab completion
@@ -2014,8 +2016,8 @@ def _restore_output(self, statement: Statement, saved_state: RedirectionSavedSta
20142016
if self.cur_pipe_proc_reader is not None:
20152017
self.cur_pipe_proc_reader.wait()
20162018

2017-
# Restore cur_pipe_proc_reader
2018-
self.cur_pipe_proc_reader = saved_state.saved_pipe_proc_reader
2019+
# Restore cur_pipe_proc_reader. This always is done, regardless of whether this command redirected.
2020+
self.cur_pipe_proc_reader = saved_state.saved_pipe_proc_reader
20192021

20202022
def cmd_func(self, command: str) -> Optional[Callable]:
20212023
"""

0 commit comments

Comments
 (0)