Skip to content

Commit

Permalink
Fix getting cwd without permission
Browse files Browse the repository at this point in the history
  • Loading branch information
idkravitz committed May 4, 2021
1 parent d4ed1f2 commit a4b6ac7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions btb_manager_telegram/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,13 @@ def get_binance_trade_bot_process() -> Optional[psutil.Process]:
bot_path = os.path.normpath(os.path.join(os.getcwd(), settings.ROOT_PATH))

for proc in psutil.process_iter():
if (
name in proc.name() or name in " ".join(proc.cmdline())
) and proc.cwd() == bot_path:
return proc
try:
if (
name in proc.name() or name in " ".join(proc.cmdline())
) and proc.cwd() == bot_path:
return proc
except psutil.AccessDenied:
continue


def find_and_kill_binance_trade_bot_process():
Expand Down

0 comments on commit a4b6ac7

Please sign in to comment.