diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-02-15 11:42:00 +0300 |
---|---|---|
committer | Innokentii Mokin <innokentii@ydb.tech> | 2024-02-16 18:35:18 +0000 |
commit | 7b5df0095abcb037bd84e4682f90c04b36796e3d (patch) | |
tree | 02de55e9d40978330b14e91aa6275ab8db1c2ba3 /contrib/python/ipython/py3/IPython/utils/_process_posix.py | |
parent | 4a82bfdb9b900b928096ffe53670200e94ec8a23 (diff) | |
download | ydb-7b5df0095abcb037bd84e4682f90c04b36796e3d.tar.gz |
Intermediate changes
Diffstat (limited to 'contrib/python/ipython/py3/IPython/utils/_process_posix.py')
-rw-r--r-- | contrib/python/ipython/py3/IPython/utils/_process_posix.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/contrib/python/ipython/py3/IPython/utils/_process_posix.py b/contrib/python/ipython/py3/IPython/utils/_process_posix.py index 59b5c23896..a429ba105a 100644 --- a/contrib/python/ipython/py3/IPython/utils/_process_posix.py +++ b/contrib/python/ipython/py3/IPython/utils/_process_posix.py @@ -20,8 +20,6 @@ import os import subprocess as sp import sys -import pexpect - # Our own from ._process_common import getoutput, arg_split from IPython.utils.encoding import DEFAULT_ENCODING @@ -51,6 +49,7 @@ class ProcessHandler(object): @property def sh(self): if self._sh is None: + import pexpect shell_name = os.environ.get("SHELL", "sh") self._sh = pexpect.which(shell_name) if self._sh is None: @@ -83,6 +82,7 @@ class ProcessHandler(object): file descriptors (so the order of the information in this string is the correct order as would be seen if running the command in a terminal). """ + import pexpect try: return pexpect.run(self.sh, args=['-c', cmd]).replace('\r\n', '\n') except KeyboardInterrupt: @@ -104,6 +104,7 @@ class ProcessHandler(object): file descriptors (so the order of the information in this string is the correct order as would be seen if running the command in a terminal). """ + import pexpect try: return pexpect.run(self.sh, args=['-c', cmd]).replace('\r\n', '\n') except KeyboardInterrupt: @@ -121,6 +122,8 @@ class ProcessHandler(object): ------- int : child's exitstatus """ + import pexpect + # Get likely encoding for the output. enc = DEFAULT_ENCODING |