Add `.cancel()` log around `_async_main()` KBI-exit
							parent
							
								
									f2ae3b0e2e
								
							
						
					
					
						commit
						4398481591
					
				|  | @ -181,7 +181,14 @@ async def _async_main( | |||
|             ): | ||||
|                 # remove startup status text | ||||
|                 starting_done() | ||||
|                 await trio.sleep_forever() | ||||
|                 try: | ||||
|                     await trio.sleep_forever() | ||||
|                 except KeyboardInterrupt as _kbi: | ||||
|                     log.cancel( | ||||
|                         f'User canceled Qt app.\n' | ||||
|                         f'{_kbi!r}' | ||||
|                     ) | ||||
|                     raise _kbi | ||||
| 
 | ||||
| 
 | ||||
| def _main( | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| # piker: trading gear for hackers | ||||
| # Copyright (C) Tyler Goodlet (in stewardship for piker0) | ||||
| # Copyright (C) Tyler Goodlet (in stewardship for pikers) | ||||
| 
 | ||||
| # This program is free software: you can redistribute it and/or modify | ||||
| # it under the terms of the GNU Affero General Public License as published by | ||||
|  |  | |||
|  | @ -217,8 +217,14 @@ class MainWindow(QMainWindow): | |||
|         '''Cancel the root actor asap. | ||||
| 
 | ||||
|         ''' | ||||
|         # raising KBI seems to get intercepted by by Qt so just use the system. | ||||
|         os.kill(os.getpid(), signal.SIGINT) | ||||
|         # raising a KBI seems to get intercepted by Qt, soo just use OS ?? | ||||
|         # TODO XXX! seems to sometimes cause Qt core dumps if you | ||||
|         # cancel during chart bootup..? | ||||
|         # -[ ] find a better/more-correct cancellation API in Qt? | ||||
|         os.kill( | ||||
|             os.getpid(), | ||||
|             signal.SIGINT, | ||||
|         ) | ||||
| 
 | ||||
|     @property | ||||
|     def status_bar(self) -> QStatusBar: | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue