Skip to content

Commit

Permalink
Improved Error Logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mjishnu committed Jun 22, 2022
1 parent c510a55 commit 4906b29
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions utls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ def install(path):
all_paths = f'Add-AppPackage "{path}"'
output = subprocess.run(
["C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\powershell.exe", all_paths], capture_output=True)
with open('log.txt', 'a') as f:
f.write(f'[installer.py, powershell command logs] \n{current_time}\n')
f.write(f'command: {output.args[1]}\n\n')
f.write(output.stderr.decode("utf-8"))
f.write(f'{82*"-"}\n')
if output.returncode != 0:
flag = 1
msg = 'Failed To Install The Application!'
Expand All @@ -30,6 +35,11 @@ def install(path):
all_paths = f'Add-AppPackage "{s_path}"'
output = subprocess.run(
["C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\powershell.exe", all_paths], capture_output=True)
with open('log.txt', 'a') as f:
f.write(f'[installer.py, powershell command logs] \n{current_time}\n')
f.write(f'command: {output.args[1]}\n\n')
f.write(output.stderr.decode("utf-8"))
f.write(f'{82*"-"}\n')
outputs.append(output.args[1])
if output.returncode != 0:
flag = 1
Expand Down

0 comments on commit 4906b29

Please sign in to comment.