Skip to content

Commit

Permalink
Fix subprocess call arguments for getting required services
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Sandakov committed Mar 19, 2024
1 parent 3fbca95 commit c6caf46
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/systemd.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ def is_service_active(service: str):


def get_required_services(service: str) -> typing.List[str]:
res = subprocess.run([SYSTEMCTL_BIN_PATH, 'cat', service], capture_output=True, text=True)
output = res.stdout.strip()
res = subprocess.run([SYSTEMCTL_BIN_PATH, 'cat', service], check=True, universal_newlines=True)

required_services = []
for line in output.split('\n'):
for line in res.stdout.splitlines():
if line.startswith('Requires='):
required_services = line.split('s=')[1].split()
break
Expand Down

0 comments on commit c6caf46

Please sign in to comment.