From 76d8424e532d51ab716bbbfc3df87a084aa9438c Mon Sep 17 00:00:00 2001 From: moon Date: Mon, 17 Jul 2023 21:14:49 -0700 Subject: [PATCH] Ignore sigterm to work in threads --- agentbrowser/browser.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/agentbrowser/browser.py b/agentbrowser/browser.py index 4522db1..b0d0621 100644 --- a/agentbrowser/browser.py +++ b/agentbrowser/browser.py @@ -1,6 +1,5 @@ import asyncio import re -import signal from pyppeteer import launch import os import platform @@ -66,7 +65,12 @@ async def async_init_browser(headless=True, executable_path=None): executable_path = find_chrome() if browser is None: - browser = await launch(headless=headless, executablePath=executable_path, autoClose=False) + browser = await launch(headless=headless, executablePath=executable_path, autoClose=False, + # set handleSIGINT to False to allow for graceful shutdown + handleSIGINT=False, + handleSIGTERM=False, + handleSIGHUP=False + ) return browser # async version of create_page