fix some minor bugs

This commit is contained in:
Ace 2024-06-23 21:08:01 +02:00
parent 309c6ca5bc
commit 13e03331f8

View File

@ -24,11 +24,12 @@ class PiSugar:
return None return None
cmd = self.command_template.replace("command", command) cmd = self.command_template.replace("command", command)
try: try:
result = subprocess.run(cmd, text=True, capture_output=True) result = subprocess.run(cmd, shell=True, text=True, capture_output=True)
if result.returncode != 0: if result.returncode != 0:
print(f"Command failed with {result.stderr}") print(f"Command failed with {result.stderr}")
return None return None
return result output = result.stdout.strip()
return output
except Exception as e: except Exception as e:
logger.error(f"Error executing command: {e}") logger.error(f"Error executing command: {e}")
return None return None