Use subprocess.run without shell=True where easily applicable, redirect unused captured output to DEVNULL

Former-commit-id: bae14d658f4e1fa04f723e8545bc35d69e0c4cbb [formerly 3a85f06ffe]
Former-commit-id: 7b7b48c870b9a6d4646d9be3d208ea792e665399
This commit is contained in:
2022-11-25 18:11:38 -05:00
parent 3392e3ceea
commit 89c9a03cc1
2 changed files with 21 additions and 25 deletions
+3 -3
View File
@@ -20,9 +20,9 @@ def get_local_data(_directory, _device): # retrieves titles and mod times from
def get_remote_data(_user_data): # retrieves titles and mod times from the remote server
_titles_mods = run(f"ssh -i '{_user_data[5]}' -p {_user_data[2]} {_user_data[0]}@{_user_data[1]} \"cd /lib/sshyp; "
f"python -c 'import sshync; sshync.get_local_data(\"'\"{_user_data[4]}\"'\", \"'\"server\"'\")"
f"'\"", shell=True, stdout=PIPE, text=True).stdout.split('\n')
_titles_mods = run(['ssh', '-i', _user_data[5], '-p', _user_data[2], f"{_user_data[0]}@{_user_data[1]}",
f'cd /lib/sshyp; python -c \'import sshync; sshync.get_local_data("{_user_data[4]}", '
f'"server")\''], stdout=PIPE, text=True).stdout.split('\n')
_title_list = _titles_mods[:len(_titles_mods)//2]
_mod_list = _titles_mods[len(_titles_mods)//2:]
return _title_list, _mod_list