Fix wrong input for subprocess, remove output capturing

Concat apt command entirely before execution.
This commit is contained in:
Marcel Schwarz 2019-12-30 01:25:16 +01:00
parent f5cd3c6234
commit 9ec51fa959

View File

@ -9,11 +9,11 @@ class CmdToolsModule(AbstractModule):
print("Try to install basic Command-line tools") print("Try to install basic Command-line tools")
with open("modules/command-line tools/programs.json") as config_file: with open("modules/command-line tools/programs.json") as config_file:
programms_list = json.load(config_file) programs_json = json.load(config_file)
programs_list = ""
for program in programs_json:
programs_list += " " + program
out = subprocess.run(["apt", "install"] + programms_list, shell=True, capture_output=True) subprocess.run("sudo apt install" + programs_list, shell=True)
if len(out.stderr) > 0:
print(out.stderr.decode()) print("Script ran to completion.")
print("Install might be not complete, please check output above.")
else:
print("Installed successful.")