diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b26be00..de265d5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Made `mepo status` serial by default due to odd fork-bomb-like behavior on some systems + ### Removed ## [1.52.0] - 2024-01-10 diff --git a/mepo.d/command/status/status.py b/mepo.d/command/status/status.py index 91720592..cae48685 100644 --- a/mepo.d/command/status/status.py +++ b/mepo.d/command/status/status.py @@ -13,10 +13,14 @@ def run(args): print('Checking status...'); sys.stdout.flush() allcomps = MepoState.read_state() - pool = mp.Pool() - atexit.register(pool.close) - result = pool.starmap(check_component_status, [(comp, args.ignore_permissions) for comp in allcomps]) - print_status(allcomps, result, args.nocolor, args.hashes) + max_width = max([len(comp.name) for comp in allcomps]) + for comp in allcomps: + result = check_component_status(comp, args.ignore_permissions) + print_component_status(comp, result, max_width, args.nocolor, args.hashes) + #pool = mp.Pool() + #atexit.register(pool.close) + #result = pool.starmap(check_component_status, [(comp, args.ignore_permissions) for comp in allcomps]) + #print_status(allcomps, result, args.nocolor, args.hashes) def check_component_status(comp, ignore_permissions): git = GitRepository(comp.remote, comp.local) @@ -41,33 +45,35 @@ def check_component_status(comp, ignore_permissions): return (curr_ver, internal_state_branch_name, git.check_status(ignore_permissions,_ignore_submodules)) -def print_status(allcomps, result, nocolor=False, hashes=False): - orig_width = len(max([comp.name for comp in allcomps], key=len)) +def print_status(allcomps, result, max_width, nocolor=False, hashes=False): + """Print the status of all components""" for index, comp in enumerate(allcomps): time.sleep(0.025) - current_version, internal_state_branch_name, output = result[index] - if hashes: - comp_path = _get_relative_path(comp.local) - comp_hash = shellcmd.run( - cmd=shlex.split(f"git -C {comp_path} rev-parse HEAD"), - output=True - ).replace("\n", "") - current_version = f"{current_version} ({comp_hash})" - # This should handle tag weirdness... - if current_version.split()[1] == comp.version.name: - component_name = comp.name - width = orig_width - # Check to see if the current tag/branch is the same as the - # original... if the above check didn't succeed, we are - # different and we colorize if asked for - elif (internal_state_branch_name not in comp.version.name) and not nocolor: - component_name = colors.RED + comp.name + colors.RESET - width = orig_width + len(colors.RED) + len(colors.RESET) - else: - component_name = comp.name - width = orig_width - FMT0 = '{:<%s.%ss} | {: