Commit f77047f
committed
webext: Rewrite native app starting logic
Using asyncio.run is preferred by Python.
`asyncio.get_event_loop` raises a `RuntimeError` on my machine,
which means that there is no event loop set.
This is a change in 3.14, seems that we need to use `asyncio.set_event_loop` before running.
So I use `asyncio.run` directly to avoid this.
Handle `SIGTERM` signal so we can quit gracefully.
Firefox will send `SIGTERM` on *nix systems, and use Windows's way to kill the native app.
Not using Windows so not sure if `SIGTERM` will also be raised on Windows,
but I do not find a clean way to notify killing.
See also: https://docs.python.org/3.14/library/asyncio-eventloop.html#asyncio.get_event_loop
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging#closing_the_native_app1 parent a6679dd commit f77047f
1 file changed
Lines changed: 24 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
395 | 396 | | |
396 | 397 | | |
397 | 398 | | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
0 commit comments