From b6ac6069fe1a178424041bd576755f7e6b438666 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 29 Sep 2023 14:02:17 -0400 Subject: [PATCH] Temporarily use crash handler around search CLI ep --- piker/brokers/cli.py | 26 ++++++++++++++------------ piker/brokers/core.py | 6 +++++- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/piker/brokers/cli.py b/piker/brokers/cli.py index 814950c7..d48ae6e5 100644 --- a/piker/brokers/cli.py +++ b/piker/brokers/cli.py @@ -482,20 +482,22 @@ def search( ): return await func() - quotes = trio.run( - main, - partial( - core.symbol_search, - brokermods, - pattern, - ), - ) + from cornerboi._debug import open_crash_handler + with open_crash_handler(): + quotes = trio.run( + main, + partial( + core.symbol_search, + brokermods, + pattern, + ), + ) - if not quotes: - log.error(f"No matches could be found for {pattern}?") - return + if not quotes: + log.error(f"No matches could be found for {pattern}?") + return - click.echo(colorize_json(quotes)) + click.echo(colorize_json(quotes)) @cli.command() diff --git a/piker/brokers/core.py b/piker/brokers/core.py index ab8b6872..6111d307 100644 --- a/piker/brokers/core.py +++ b/piker/brokers/core.py @@ -145,7 +145,11 @@ async def symbol_search( async with maybe_spawn_brokerd( mod.name, - infect_asyncio=getattr(mod, '_infect_asyncio', False), + infect_asyncio=getattr( + mod, + '_infect_asyncio', + False, + ), ) as portal: results.append((