copying cfg file to central repo, fix ssh host key

+ some other improvements
This commit is contained in:
2026-08-20 17:43:47 +02:00
parent 2bf5c24dd9
commit e81d0db1ca
2 changed files with 44 additions and 11 deletions
+7 -4
View File
@@ -258,13 +258,16 @@ def unix_cmd(cmd, *args, execute=None, stdout=PIPE, sudo=True):
command.insert(1, '--user')
if sudo:
command.insert(0, 'sudo')
# sudo = ['sudo'] if sudo else []
if execute is not False: # None or True
if execute:
print('$', *command)
# result = Popen(sudo + command, stdout=stdout).communicate()[0]
result = Popen(command, stdout=stdout).communicate()[0]
return (result or b'').decode()
try:
result = Popen(command, stdout=stdout).communicate()[0]
return (result or b'').decode()
except Exception as e:
print(f'error {e!r}')
finally:
pass
else:
print('>', *command)