MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / _initialize_persistent_process

Method _initialize_persistent_process

bmtools/tools/shell/api.py:47–58  ·  view source on GitHub ↗
(prompt: str)

Source from the content-addressed store, hash-verified

45
46 @staticmethod
47 def _initialize_persistent_process(prompt: str) -> pexpect.spawn:
48 # Start bash in a clean environment
49 # Doesn't work on windows
50 pexpect = _lazy_import_pexpect()
51 process = pexpect.spawn(
52 "env", ["-i", "bash", "--norc", "--noprofile"], encoding="utf-8"
53 )
54 # Set the custom prompt
55 process.sendline("PS1=" + prompt)
56
57 process.expect_exact(prompt, timeout=10)
58 return process
59
60 def run(self, commands: Union[str, List[str]]) -> str:
61 """Run commands and return final output."""

Callers 1

__init__Method · 0.95

Calls 1

_lazy_import_pexpectFunction · 0.85

Tested by

no test coverage detected