|
56 | 56 |
|
57 | 57 | # Set up readline |
58 | 58 | if rl_type == RlType.NONE: # pragma: no cover |
59 | | - rl_warning = "Readline features including tab completion have been disabled since no \n" \ |
60 | | - "supported version of readline was found. To resolve this, install \n" \ |
61 | | - "pyreadline on Windows or gnureadline on Mac.\n\n" |
| 59 | + rl_warning = ("Readline features including tab completion have been disabled since no\n" |
| 60 | + "supported version of readline was found. To resolve this, install pyreadline\n" |
| 61 | + "on Windows or gnureadline on Mac.\n\n") |
62 | 62 | sys.stderr.write(ansi.style_warning(rl_warning)) |
63 | 63 | else: |
64 | 64 | from .rl_utils import rl_force_redisplay, readline |
@@ -1824,24 +1824,22 @@ def _redirect_output(self, statement: Statement) -> Tuple[bool, utils.Redirectio |
1824 | 1824 | subproc_stdin = io.open(read_fd, 'r') |
1825 | 1825 | new_stdout = io.open(write_fd, 'w') |
1826 | 1826 |
|
1827 | | - # Set options to not forward signals to the pipe process. If a Ctrl-C event occurs, |
1828 | | - # our sigint handler will forward it only to the most recent pipe process. This makes |
1829 | | - # sure pipe processes close in the right order (most recent first). |
| 1827 | + # Create pipe process in a separate group to isolate our signals from it. If a Ctrl-C event occurs, |
| 1828 | + # our sigint handler will forward it only to the most recent pipe process. This makes sure pipe |
| 1829 | + # processes close in the right order (most recent first). |
| 1830 | + kwargs = dict() |
1830 | 1831 | if sys.platform == 'win32': |
1831 | | - creationflags = subprocess.CREATE_NEW_PROCESS_GROUP |
1832 | | - start_new_session = False |
| 1832 | + kwargs['creationflags'] = subprocess.CREATE_NEW_PROCESS_GROUP |
1833 | 1833 | else: |
1834 | | - creationflags = 0 |
1835 | | - start_new_session = True |
| 1834 | + kwargs['start_new_session'] = True |
1836 | 1835 |
|
1837 | 1836 | # For any stream that is a StdSim, we will use a pipe so we can capture its output |
1838 | 1837 | proc = subprocess.Popen(statement.pipe_to, |
1839 | 1838 | stdin=subproc_stdin, |
1840 | 1839 | stdout=subprocess.PIPE if isinstance(self.stdout, utils.StdSim) else self.stdout, |
1841 | 1840 | stderr=subprocess.PIPE if isinstance(sys.stderr, utils.StdSim) else sys.stderr, |
1842 | | - creationflags=creationflags, |
1843 | | - start_new_session=start_new_session, |
1844 | | - shell=True) |
| 1841 | + shell=True, |
| 1842 | + **kwargs) |
1845 | 1843 |
|
1846 | 1844 | # Popen was called with shell=True so the user can chain pipe commands and redirect their output |
1847 | 1845 | # like: !ls -l | grep user | wc -l > out.txt. But this makes it difficult to know if the pipe process |
|
0 commit comments