Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Kundert authored and Ken Kundert committed Nov 16, 2024
1 parent 67b79db commit 9bdcae0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions emborg/shlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def __init__(
self.merge_stderr_into_stdout = False
self.status = None
self.wait_for_termination = True
self.encoding = PREFERENCES["encoding"] if encoding is None else encoding
self.encoding = encoding or PREFERENCES["encoding"]
self.log = log
self.option_args = option_args
self._interpret_modes(modes)
Expand Down Expand Up @@ -595,13 +595,16 @@ def _interpret_modes(self, modes):
self.accept = _Accept(accept)

# run {{{3
def run(self, stdin=None):
def run(self, stdin=None, **kwargs):
"""
Run the command, will wait for it to terminate.
If stdin is given, it should be a string. Otherwise, no connection is
made to stdin of the command.
Any other arguments must be keyword arguments and they are passed to
subprocess.Popen.
Returns exit status if wait_for_termination is True.
If wait_for_termination is False, you must call wait(), otherwise stdin
is not be applied. If you don't want to wait, call start() instead.
Expand Down Expand Up @@ -633,7 +636,7 @@ def run(self, stdin=None):
# run the command
try:
process = subprocess.Popen(
cmd, shell=self.use_shell, env=self.env, **streams
cmd, shell=self.use_shell, env=self.env, **streams, **kwargs
)
except OSError as e:
if PREFERENCES["use_inform"]:
Expand Down Expand Up @@ -821,6 +824,7 @@ def __init__(
encoding=None,
log=None,
option_args=None,
**kwargs,
):
self.cmd = cmd
self.stdin = None
Expand All @@ -831,11 +835,11 @@ def __init__(
self.wait_for_termination = True
self.accept = (0,)
self.env = env
self.encoding = PREFERENCES["encoding"] if not encoding else encoding
self.encoding = encoding or PREFERENCES["encoding"]
self.log = log
self.option_args = option_args
self._interpret_modes(modes)
self.run(stdin)
self.run(stdin, **kwargs)


# Sh class (deprecated) {{{2
Expand Down

0 comments on commit 9bdcae0

Please sign in to comment.