multiCMD 1.31__tar.gz → 1.33__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: multiCMD
3
- Version: 1.31
3
+ Version: 1.33
4
4
  Summary: Run commands simultaneously
5
5
  Home-page: https://github.com/yufei-pan/multiCMD
6
6
  Author: Yufei Pan
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: multiCMD
3
- Version: 1.31
3
+ Version: 1.33
4
4
  Summary: Run commands simultaneously
5
5
  Home-page: https://github.com/yufei-pan/multiCMD
6
6
  Author: Yufei Pan
@@ -18,10 +18,10 @@ import re
18
18
  import itertools
19
19
  import signal
20
20
 
21
- version = '1.31'
21
+ version = '1.33'
22
22
  __version__ = version
23
23
 
24
- __running_threads = []
24
+ __running_threads = set()
25
25
  __variables = {}
26
26
  class Task:
27
27
  def __init__(self, command):
@@ -232,7 +232,7 @@ _BRACKET_RX = re.compile(r'\[([^\]]+)\]')
232
232
  _ALPHANUM = string.digits + string.ascii_letters
233
233
  _ALPHA_IDX = {c: i for i, c in enumerate(_ALPHANUM)}
234
234
 
235
- def _expand_piece(piece: str, vars_: dict[str, str]) -> list[str]:
235
+ def _expand_piece(piece, vars_):
236
236
  """Turn one comma-separated element from inside [...] into a list of strings."""
237
237
  piece = piece.strip()
238
238
 
@@ -267,7 +267,7 @@ def _expand_piece(piece: str, vars_: dict[str, str]) -> list[str]:
267
267
  # plain token or ${var}
268
268
  return [vars_.get(piece, piece)]
269
269
 
270
- def _expand_ranges_fast(inStr: str) -> list[str]:
270
+ def _expand_ranges_fast(inStr):
271
271
  global __variables
272
272
  segments: list[list[str]] = []
273
273
  pos = 0
@@ -662,7 +662,7 @@ def run_commands(commands, timeout=0,max_threads=1,quiet=False,dry_run=False,wit
662
662
  for thread in threads:
663
663
  thread.join()
664
664
  else:
665
- __running_threads.extend(threads)
665
+ __running_threads.update(threads)
666
666
  else:
667
667
  # just process the commands sequentially
668
668
  sem = threading.Semaphore(1)
@@ -689,8 +689,11 @@ def join_threads(threads=__running_threads,timeout=None):
689
689
  @returns:
690
690
  None
691
691
  '''
692
+ global __running_threads
692
693
  for thread in threads:
693
694
  thread.join(timeout=timeout)
695
+ if threads is __running_threads:
696
+ __running_threads = {t for t in threads if t.is_alive()}
694
697
 
695
698
  def input_with_timeout_and_countdown(timeout, prompt='Please enter your selection'):
696
699
  """
File without changes
File without changes
File without changes