Skip to content

Commit

Permalink
Improve output
Browse files Browse the repository at this point in the history
  • Loading branch information
Willenst committed Nov 1, 2024
1 parent b2a2a91 commit 62e3e6c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions manage_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def rm(self):
subprocess.run(cmd, text=True, check=True)
self.check()
return ''
return '\n'.join(running)
return ''.join(running)

def check(self):
"""Check whether the container exists and get its image ID"""
Expand All @@ -100,7 +100,6 @@ def identify_runtime_cmd(self):
cmd = ['docker', 'ps']
out = subprocess.run(cmd, text=True, check=False, capture_output=True)
if out.returncode == 0:
print('We don\'t need "sudo" for working with containers')
return ['docker']
if 'permission denied' in out.stderr:
print('We need "sudo" for working with containers')
Expand Down Expand Up @@ -131,7 +130,7 @@ def remove_containers(containers):
for c in containers:
if c.id:
print(f'Removing Ubuntu-{c.ubuntu} container with GCC-{c.gcc} and Clang-{c.clang}')
out = out + c.rm()
out = out + '\n' + c.rm()
if out:
print('\nYou still have running containers, that can\'t be removed:\n'+out)

Expand Down

0 comments on commit 62e3e6c

Please sign in to comment.