fixed an issue with the windows event loop not working with asyncio.create_subprocess_shell

This commit is contained in:
UpstreamData
2022-05-26 15:25:04 -06:00
parent 513dd2b981
commit a8ce73c3d6

View File

@@ -21,12 +21,12 @@ CONFIG_FILE = os.path.join(os.path.dirname(__file__), "files", "config.toml")
# static states # static states
(START, UNLOCK, INSTALL, UPDATE, REFERRAL, DONE, ERROR) = range(7) (START, UNLOCK, INSTALL, UPDATE, REFERRAL, DONE, ERROR) = range(7)
if ( # if (
sys.version_info[0] == 3 # sys.version_info[0] == 3
and sys.version_info[1] >= 8 # and sys.version_info[1] >= 8
and sys.platform.startswith("win") # and sys.platform.startswith("win")
): # ):
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
class Singleton(type): class Singleton(type):
@@ -466,6 +466,7 @@ class TestbenchMiner:
logging.error(f"{self.host}: {E}") logging.error(f"{self.host}: {E}")
await self.add_to_output(f"Error: {E}") await self.add_to_output(f"Error: {E}")
except RuntimeError as E: except RuntimeError as E:
raise E
logging.error(f"{self.host}: {E}") logging.error(f"{self.host}: {E}")
await self.add_to_output(f"Error: {E}") await self.add_to_output(f"Error: {E}")
asyncio.create_task(self.install_loop()) asyncio.create_task(self.install_loop())