Skip to content

Commit

Permalink
Extend debug capabilitites for requirements.txt installation step on …
Browse files Browse the repository at this point in the history
…autoupdate

Add stdout and stderr output of pip in the email logger
  • Loading branch information
aobolensk committed Apr 21, 2024
1 parent 2f4411d commit d518039
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/autoupdate_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,15 @@ def check_updates(context: AutoUpdateContext) -> bool:
log.warning(f"{e.command}: {e.stderr}")
else:
raise e
p = subprocess.run(f"{sys.executable} -m pip install -r requirements.txt", shell=True)
p = subprocess.run(f"{sys.executable} -m pip install -r requirements.txt", shell=True, capture_output=True)
if p.returncode != 0:
mail.send(
secret_config.admin_email_list,
"Autoupdate error",
get_autoupdate_error_message(f"Failed to fetch requirements.txt. Return code: {p.returncode}"))
get_autoupdate_error_message(
f"Failed to fetch requirements.txt. Return code: {p.returncode}\n"
f"stdout:\n{p.stdout}\n"
f"stderr:\n{p.stderr}\n"))
minibot_response = "WalBot automatic update is in progress. Please, wait..."
subprocess.call(f"{sys.executable} walbot.py startmini --message '{minibot_response}' --nohup &", shell=True)
p = subprocess.run(f"{sys.executable} walbot.py stop", shell=True)
Expand Down

0 comments on commit d518039

Please sign in to comment.