mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-22 02:50:31 +00:00
@@ -88,7 +88,7 @@ class BashProcess:
|
||||
|
||||
Args:
|
||||
Prompt(str): the bash command to execute
|
||||
""" # noqa: E501
|
||||
"""
|
||||
pexpect = self._lazy_import_pexpect()
|
||||
process = pexpect.spawn(
|
||||
"env", ["-i", "bash", "--norc", "--noprofile"], encoding="utf-8"
|
||||
@@ -107,7 +107,7 @@ class BashProcess:
|
||||
Args:
|
||||
commands(List[str]): a list of commands to
|
||||
execute in the session
|
||||
""" # noqa: E501
|
||||
"""
|
||||
if isinstance(commands, str):
|
||||
commands = [commands]
|
||||
commands = ";".join(commands)
|
||||
@@ -125,7 +125,7 @@ class BashProcess:
|
||||
|
||||
Args:
|
||||
command: The command to run
|
||||
""" # noqa: E501
|
||||
"""
|
||||
try:
|
||||
output = subprocess.run(
|
||||
command,
|
||||
@@ -149,7 +149,7 @@ class BashProcess:
|
||||
Args:
|
||||
output: a process' output string
|
||||
command: the executed command
|
||||
""" # noqa: E501
|
||||
"""
|
||||
pattern = re.escape(command) + r"\s*\n"
|
||||
output = re.sub(pattern, "", output, count=1)
|
||||
return output.strip()
|
||||
@@ -161,7 +161,7 @@ class BashProcess:
|
||||
|
||||
Args:
|
||||
command: the command to execute
|
||||
""" # noqa: E501
|
||||
"""
|
||||
pexpect = self._lazy_import_pexpect()
|
||||
if self.process is None:
|
||||
raise ValueError("Process not initialized")
|
||||
|
Reference in New Issue
Block a user