Skip to content

Commit

Permalink
Fix: make values in stdout compatible with bash or similar shells. Er…
Browse files Browse the repository at this point in the history
…ase progress counter when done.
  • Loading branch information
Poikilos authored Aug 28, 2024
1 parent 51e7516 commit 057fcbf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mac_throttle.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def get_powermetrics_data():
missing_keys = ', '.join(missing)
print("\npowermetrics completed, but the following keys are missing: " + missing_keys, file=sys.stderr)
else:
print("\r100% ", file=sys.stderr)
print("\r ", file=sys.stderr)
# Process throttle_str to extract percentage and MHz

throttle_str = powermetrics_dict.get("System Average frequency as fraction of nominal")
Expand Down Expand Up @@ -147,4 +147,5 @@ def combine_dictionaries(*args):

# Display the combined key-value pairs
for key, value in combined_values.items():
print("{}={}".format(key.replace(".", "_").replace(" ", "_"), value))
print('{}="{}"'.format(key.replace(".", "_").replace(" ", "_"),
value.replace('"','\\"')))

0 comments on commit 057fcbf

Please sign in to comment.