From 87cd91b409ca9404d402e1df2a5dec19e9fd40b5 Mon Sep 17 00:00:00 2001 From: Erik Cederstrand Date: Thu, 4 Aug 2022 13:34:03 +0200 Subject: [PATCH] Allow customizing the RunningCommand class. Refs #604 --- sh.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sh.py b/sh.py index 0353e82c..f328cb64 100644 --- a/sh.py +++ b/sh.py @@ -1161,6 +1161,7 @@ class Command(object): RunningCommand object, which represents the Command put into an execution state. """ thread_local = threading.local() + RunningCommandCls = RunningCommand _call_args = { "fg": False, # run command in foreground @@ -1521,7 +1522,7 @@ def __call__(self, *args, **kwargs): if output_redirect_is_filename(stderr): stderr = open(str(stderr), "wb") - return RunningCommand(cmd, call_args, stdin, stdout, stderr) + return self.__class__.RunningCommandCls(cmd, call_args, stdin, stdout, stderr) def compile_args(a, kwargs, sep, prefix):