kkpyutil 1.28.2__tar.gz → 1.29.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kkpyutil-1.28.2 → kkpyutil-1.29.1}/PKG-INFO +1 -1
- {kkpyutil-1.28.2 → kkpyutil-1.29.1}/kkpyutil.py +9 -5
- {kkpyutil-1.28.2 → kkpyutil-1.29.1}/pyproject.toml +1 -1
- {kkpyutil-1.28.2 → kkpyutil-1.29.1}/LICENSE +0 -0
- {kkpyutil-1.28.2 → kkpyutil-1.29.1}/README.md +0 -0
- {kkpyutil-1.28.2 → kkpyutil-1.29.1}/kkpyutil_helper/windows/kkttssave.ps1 +0 -0
- {kkpyutil-1.28.2 → kkpyutil-1.29.1}/kkpyutil_helper/windows/kkttsspeak.ps1 +0 -0
|
@@ -1058,7 +1058,7 @@ def run_cmd(cmd, cwd=None, logger=None, check=True, shell=False, verbose=False,
|
|
|
1058
1058
|
console_info = logger.info if logger and verbose else logger.debug
|
|
1059
1059
|
# show cmdline with or without exceptions
|
|
1060
1060
|
cmd_log = f"""\
|
|
1061
|
-
{' '.join(cmd)}
|
|
1061
|
+
{' '.join([str(comp) for comp in cmd])}
|
|
1062
1062
|
cwd: {osp.abspath(cwd) if cwd else os.getcwd()}
|
|
1063
1063
|
"""
|
|
1064
1064
|
logger.info(cmd_log)
|
|
@@ -1103,7 +1103,7 @@ def run_daemon(cmd, cwd=None, logger=None, shell=False, useexception=True, env=N
|
|
|
1103
1103
|
"""
|
|
1104
1104
|
logger = logger or glogger
|
|
1105
1105
|
logger.debug(f"""run in background:
|
|
1106
|
-
{
|
|
1106
|
+
{' '.join([str(comp) for comp in cmd])}
|
|
1107
1107
|
cwd: {osp.abspath(cwd) if cwd else os.getcwd()}
|
|
1108
1108
|
""")
|
|
1109
1109
|
# fake the same proc interface
|
|
@@ -1139,7 +1139,7 @@ def watch_cmd(cmd, cwd=None, logger=None, shell=False, verbose=False, useexcepti
|
|
|
1139
1139
|
logger = logger or glogger
|
|
1140
1140
|
# show cmdline with or without exceptions
|
|
1141
1141
|
cmd_log = f"""\
|
|
1142
|
-
{' '.join(cmd)}
|
|
1142
|
+
{' '.join([str(comp) for comp in cmd])}
|
|
1143
1143
|
cwd: {osp.abspath(cwd) if cwd else os.getcwd()}
|
|
1144
1144
|
"""
|
|
1145
1145
|
logger.info(cmd_log)
|
|
@@ -2780,13 +2780,15 @@ def merge_namespaces(to_ns: types.SimpleNamespace, from_ns: types.SimpleNamespac
|
|
|
2780
2780
|
return to_ns
|
|
2781
2781
|
|
|
2782
2782
|
|
|
2783
|
-
def thread_timeout(seconds):
|
|
2783
|
+
def thread_timeout(seconds, bypass=False):
|
|
2784
2784
|
"""
|
|
2785
2785
|
- for single-process function only
|
|
2786
2786
|
- will not work if decorated function spawns subprocesses
|
|
2787
2787
|
"""
|
|
2788
2788
|
def decorator(func):
|
|
2789
2789
|
def wrapper(*args, **kwargs):
|
|
2790
|
+
if bypass:
|
|
2791
|
+
return func(*args, **kwargs)
|
|
2790
2792
|
# Create a thread to run the function
|
|
2791
2793
|
thread = threading.Thread(target=func, args=args, kwargs=kwargs)
|
|
2792
2794
|
thread.start()
|
|
@@ -2810,11 +2812,13 @@ def _run_container(func, cont_queue, args, kwargs):
|
|
|
2810
2812
|
cont_queue.put(e)
|
|
2811
2813
|
|
|
2812
2814
|
|
|
2813
|
-
def process_timeout(seconds):
|
|
2815
|
+
def process_timeout(seconds, bypass=False):
|
|
2814
2816
|
def decorator(func):
|
|
2815
2817
|
func_name = f'{func.__module__}.{func.__name__}'
|
|
2816
2818
|
|
|
2817
2819
|
def wrapper(*args, **kwargs):
|
|
2820
|
+
if bypass:
|
|
2821
|
+
return func(*args, **kwargs)
|
|
2818
2822
|
# Create a thread to run the function
|
|
2819
2823
|
cont_queue = multiprocessing.Queue()
|
|
2820
2824
|
proc = multiprocessing.Process(target=_run_container, args=(func_name, cont_queue, args,), kwargs=kwargs)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|