Skip to content

Commit

Permalink
munet: 0.14.7, allow multiple extra commands for shell console init
Browse files Browse the repository at this point in the history
  • Loading branch information
choppsv1 committed May 17, 2024
1 parent 63af94d commit 3057893
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 13 additions & 4 deletions munet/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,14 @@ async def shell_spawn(

ps1 = re.escape(ps1)
ps2 = re.escape(ps2)

extra = "PAGER=cat; export PAGER; TERM=dumb; unset HISTFILE; set +o emacs +o vi"
extra = [
"TERM=dumb",
"set +o emacs",
"set +o vi",
"unset HISTFILE",
"PAGER=cat",
"export PAGER",
]
pchg = "PS1='{0}' PS2='{1}' PROMPT_COMMAND=''\n".format(ps1p, ps2p)
p.send(pchg)
return ShellWrapper(p, ps1, ps2, extra_init_cmd=extra, will_echo=will_echo)
Expand Down Expand Up @@ -2993,8 +2999,11 @@ def __init__(
self._expectf = self.child.expect

if extra_init_cmd:
self.expect_prompt()
self.child.sendline(extra_init_cmd)
if isinstance(extra_init_cmd, str):
extra_init_cmd = [extra_init_cmd]
for ecmd in extra_init_cmd:
self.expect_prompt()
self.child.sendline(ecmd)
self.expect_prompt()

def expect_prompt(self, timeout=-1):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "munet"
version = "0.14.6"
version = "0.14.7"
description = "A package to facilitate network simulations"
authors = ["Christian Hopps <[email protected]>"]
license = "GPL-2.0-or-later"
Expand Down

0 comments on commit 3057893

Please sign in to comment.